netdev
[Top] [All Lists]

[Fwd: PATCH pktgen hang, memleak, fixes]

To: Maillist netdev <netdev@xxxxxxxxxxx>
Subject: [Fwd: PATCH pktgen hang, memleak, fixes]
From: Jeff Garzik <jgarzik@xxxxxxxxx>
Date: Thu, 10 Jul 2003 13:40:53 -0400
Organization: none
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk
--- Begin Message ---
To: linux-kernel@xxxxxxxxxxxxxxx
Subject: PATCH pktgen hang, memleak, fixes
From: "Kambo Lohan" <kambo77@xxxxxxxxxxx>
Date: Thu, 10 Jul 2003 11:22:24 -0400
Delivered-to: garzik@xxxxxxx
Delivered-to: jgarzik@xxxxxxxxx
Sender: linux-kernel-owner@xxxxxxxxxxxxxxx
This should fix about 3 things.  My first patch, be gentle...

2.5 has the same problem but I do not know if this will apply or not, we run 2.4.




--- linux-2.4.21/net/core/pktgen.c      2002-11-28 18:53:15.000000000 -0500
+++ linux-2.4-kjp/net/core/pktgen.c     2003-07-10 11:08:31.000000000 -0400
@@ -34,6 +34,7 @@
 *   *  The new changes seem to have a performance impact of around 1%,
 *       as far as I can tell.
 *   --Ben Greear <greearb@xxxxxxxxxxxxxxx>
+ * Fix refcount off by one if first packet fails, potential null deref, memleak 030710- KJP
 *
* Renamed multiskb to clone_skb and cleaned up sending core for two distinct
 * skb modes. A clone_skb=0 mode for Ben "ranges" work and a clone_skb != 0
@@ -84,9 +85,9 @@
#define cycles()        ((u32)get_cycles())


-#define VERSION "pktgen version 1.2"
+#define VERSION "pktgen version 1.2.1"
static char version[] __initdata =
-  "pktgen.c: v1.2: Packet Generator for packet performance testing.\n";
+  "pktgen.c: v1.2.1: Packet Generator for packet performance testing.\n";

/* Used to help with determining the pkts on receive */

@@ -613,12 +614,11 @@
                                kfree_skb(skb);
                                skb = fill_packet(odev, info);
                                if (skb == NULL) {
-                                        break;
+                                       goto out_reldev;
                                }
                                fp++;
                                fp_tmp = 0; /* reset counter */
                        }
-                        atomic_inc(&skb->users);
                }

                nr_frags = skb_shinfo(skb)->nr_frags;
@@ -634,9 +634,10 @@
                                last_ok = 0;
                        }
                        else {
-                          last_ok = 1;
-                           info->sofar++;
-                           info->seq_num++;
+                               atomic_inc(&skb->users);
+                               last_ok = 1;
+                               info->sofar++;
+                               info->seq_num++;
                        }
                }
                else {
@@ -707,6 +708,7 @@
                }
        }/* while we should be running */

+
        do_gettimeofday(&(info->stopped_at));

        total = (info->stopped_at.tv_sec - info->started_at.tv_sec) * 1000000 +
@@ -731,6 +733,8 @@
                             (unsigned long long) info->errors
                             );
        }
+
+       kfree_skb(skb);

out_reldev:
        if (odev) {

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



--- End Message ---
<Prev in Thread] Current Thread [Next in Thread>
  • [Fwd: PATCH pktgen hang, memleak, fixes], Jeff Garzik <=