[PATCH] Need to check skb is null before freeing

Erik Hovland <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
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.

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.