Re: [PATCH] net/appletalk/ddp.c: small fix in skb usage

From: Arnaldo Carvalho de Melo (acme@conectiva.com.br)
Date: Mon Aug 21 2000 - 13:13:58 EST


Em Mon, Aug 21, 2000 at 01:20:40PM -0700, David S. Miller escreveu:
> Date: Sun, 20 Aug 2000 03:18:22 -0300
> From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
>
> Please take a look and consider applying.
>
> I can't see how this change is correct, the existing code is buggy for
> sure, but the fix is nearly worse than the cure, so shouldn't the
> change be:
>
> 1) sed 's/kfree(skb)/kfree_skb(skb)//'
> 2) If newskb == NULL, return 0
> 3) Else skb = newskb, and continue on to transmit the ddp message
>
> If you agree, please send a new patch which in fact does this.

agreed, here's the new patch.

- Arnaldo

--- linux-2.4.0-test7-pre5/net/appletalk/ddp.c Fri Jul 28 06:35:01 2000
+++ linux-2.4.0-test7-pre5.acme/net/appletalk/ddp.c Mon Aug 21 15:13:08 2000
@@ -1611,7 +1611,10 @@
                         struct sk_buff *newskb;
                         /* 22 bytes - 12 ether, 2 len, 3 802.2 5 snap */
                         newskb = skb_realloc_headroom(skb, 32);
- kfree(skb);
+ kfree_skb(skb);
+ if (!newskb)
+ return 0;
+ skb = newskb;
                 }
                 else
                         skb = skb_unshare(skb, GFP_ATOMIC);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Aug 23 2000 - 21:00:05 EST