* Re: PATCH pktgen hang, memleak, fixes
@ 2003-07-19 17:34 Kambo Lohan
0 siblings, 0 replies; 3+ messages in thread
From: Kambo Lohan @ 2003-07-19 17:34 UTC (permalink / raw)
To: Robert.Olsson; +Cc: netdev, linux-kernel
That patch is bad please use the updated patch ([PATCH] [UPDATED] pktgen
fixes on netdev)....I will attempt to repost while snipping the whitespace
change
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
--- 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 13:22:17.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@candelatech.com>
+ * 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;
@@ -626,7 +626,9 @@
spin_lock_bh(&odev->xmit_lock);
if (!netif_queue_stopped(odev)) {
+ atomic_inc(&skb->users);
if (odev->hard_start_xmit(skb, odev)) {
+ atomic_dec(&skb->users);
if (net_ratelimit()) {
printk(KERN_INFO "Hard xmit error\n");
}
@@ -731,6 +733,8 @@
(unsigned long long) info->errors
);
}
+
+ kfree_skb(skb);
out_reldev:
if (odev) {
_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
^ permalink raw reply [flat|nested] 3+ messages in thread
* PATCH pktgen hang, memleak, fixes
2003-07-10 15:22 Kambo Lohan
@ 2003-07-19 16:32 ` Robert Olsson
0 siblings, 0 replies; 3+ messages in thread
From: Robert Olsson @ 2003-07-19 16:32 UTC (permalink / raw)
To: Kambo Lohan; +Cc: netdev, linux-kernel
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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* PATCH pktgen hang, memleak, fixes
@ 2003-07-10 15:22 Kambo Lohan
2003-07-19 16:32 ` Robert Olsson
0 siblings, 1 reply; 3+ messages in thread
From: Kambo Lohan @ 2003-07-10 15:22 UTC (permalink / raw)
To: linux-kernel
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@candelatech.com>
+ * 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-07-19 17:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-19 17:34 PATCH pktgen hang, memleak, fixes Kambo Lohan
-- strict thread matches above, loose matches on Subject: below --
2003-07-10 15:22 Kambo Lohan
2003-07-19 16:32 ` Robert Olsson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).