mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robert Olsson <Robert.Olsson@data.slu.se>
To: "Kambo Lohan" <kambo77@hotmail.com>
Cc: netdev@oss.sgi.com, linux-kernel@vger.kernel.org
Subject: PATCH pktgen hang, memleak, fixes
Date: Sat, 19 Jul 2003 18:32:32 +0200	[thread overview]
Message-ID: <16153.29344.964485.457389@robur.slu.se> (raw)
In-Reply-To: <Sea2-F47vJo8jUbRX8z000320b1@hotmail.com>


Thanks!
It looks fine. Jeff cross-posted to netdev which is the appropriate list. 
It goes for both 2.4 and 2.5 versions. We ask DaveM to apply.

Cheers.
					--ro


Kambo Lohan writes:
 > 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/net/core/pktgen.c.orig	Thu Jul 17 16:00:14 2003
+++ linux/net/core/pktgen.c	Thu Jul 17 16:37:21 2003
@@ -47,6 +47,9 @@
  * Also moved to /proc/net/pktgen/ 
  * --ro 
  *
+ * Fix refcount off by one if first packet fails, potential null deref, 
+ * memleak 030710- KJP
+ *
  * See Documentation/networking/pktgen.txt for how to use this.
  */
 
@@ -85,9 +88,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 */
 
@@ -611,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;
@@ -632,6 +634,7 @@
 				last_ok = 0;
 			}
 			else {
+			   atomic_inc(&skb->users);
 			   last_ok = 1;	
 			   info->sofar++;
 			   info->seq_num++;
@@ -729,7 +732,9 @@
 			     (unsigned long long) info->errors
 			     );
 	}
-	
+
+	kfree_skb(skb);
+
 out_reldev:
 	if (odev) {
 		dev_put(odev);


  reply	other threads:[~2003-07-19 16:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-10 15:22 Kambo Lohan
2003-07-19 16:32 ` Robert Olsson [this message]
2003-07-19 17:34 Kambo Lohan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16153.29344.964485.457389@robur.slu.se \
    --to=robert.olsson@data.slu.se \
    --cc=kambo77@hotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®