Re: [PATCH] Need to check skb is null before freeing
David Brownell <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <[email protected]> |
On Tuesday 17 April 2007 4:34 pm, Erik Hovland wrote:
> Because dev_kfree_skb_any will dereference the skb before actually
> freeing we need to check to make sure skb is not null. This is because
> at line 1655 we might have hit the goto because the skb could not be
> allocated.
Erm, sortof. (And since you didn't sign off on this patch,
I'm suspecting you thought this was a bit odd too...)
Last time this came up the question was why the network code
has an asymmetry there. The other network paths check for
null -- but not that one.
Please submit a patch against the network code instead ... if
that gets rejected, we can update this code, but meanwhile
it looks like the real problem is in the network stack.
- Dave
> Index: linux-2.6.x-hhy/drivers/usb/gadget/ether.c
> ===================================================================
> --- linux-2.6.x-hhy.orig/drivers/usb/gadget/ether.c
> +++ linux-2.6.x-hhy/drivers/usb/gadget/ether.c
> @@ -1672,7 +1672,8 @@ enomem:
> defer_kevent (dev, WORK_RX_MEMORY);
> if (retval) {
> DEBUG (dev, "rx submit --> %d\n", retval);
> - dev_kfree_skb_any (skb);
> + if (skb)
> + dev_kfree_skb_any (skb);
> spin_lock(&dev->req_lock);
> list_add (&req->list, &dev->rx_reqs);
> spin_unlock(&dev->req_lock);
>
> --
> Erik Hovland
> mail: [email protected]
> web: http://hovland.org/
> PGP/GPG public key available on request
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel