summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.com>2016-03-07 11:31:10 +0100
committerSasha Levin <sasha.levin@oracle.com>2016-07-10 23:07:00 -0400
commit900aa9788446a8bc7fc40f21199bbe1dbdc1bf19 (patch)
tree5db6fa7bbeac5cfee303a3a268c630b8c275e09d /drivers/net
parentcf852e989018e95f25e8a620f77e380812a9460f (diff)
usbnet: cleanup after bind() in probe()
[ Upstream commit 1666984c8625b3db19a9abc298931d35ab7bc64b ] In case bind() works, but a later error forces bailing in probe() in error cases work and a timer may be scheduled. They must be killed. This fixes an error case related to the double free reported in http://www.spinics.net/lists/netdev/msg367669.html and needs to go on top of Linus' fix to cdc-ncm. Signed-off-by: Oliver Neukum <ONeukum@suse.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/usb/usbnet.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index e0498571ae26..edbb2f389337 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1754,6 +1754,13 @@ out3:
if (info->unbind)
info->unbind (dev, udev);
out1:
+ /* subdrivers must undo all they did in bind() if they
+ * fail it, but we may fail later and a deferred kevent
+ * may trigger an error resubmitting itself and, worse,
+ * schedule a timer. So we kill it all just in case.
+ */
+ cancel_work_sync(&dev->kevent);
+ del_timer_sync(&dev->delay);
free_netdev(net);
out:
return status;