* [PATCH] usbnet: cleanup after bind() in probe()
@ 2016-03-07 10:31 Oliver Neukum
2016-03-07 16:41 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Neukum @ 2016-03-07 10:31 UTC (permalink / raw)
To: andreyknvl-Re5JQEeQqe8AvxtiuMwx3w,
linux-usb-u79uwXL29TY76Z2rM5mHXA, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
netdev-u79uwXL29TY76Z2rM5mHXA, bjorn-yOkvZcmFvRU
Cc: Oliver Neukum, Oliver Neukum
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-IBi9RG/b67k@public.gmane.org>
---
drivers/net/usb/usbnet.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 0b0ba7e..1079812 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1769,6 +1769,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;
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usbnet: cleanup after bind() in probe()
2016-03-07 10:31 [PATCH] usbnet: cleanup after bind() in probe() Oliver Neukum
@ 2016-03-07 16:41 ` David Miller
[not found] ` <20160307.114125.198056880799710267.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2016-03-07 16:41 UTC (permalink / raw)
To: oneukum; +Cc: andreyknvl, linux-usb, netdev, bjorn
From: Oliver Neukum <oneukum@suse.com>
Date: Mon, 7 Mar 2016 11:31:10 +0100
> 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>
Applied, thanks Oliver.
How far back does this bug exist? I'm trying to figure out what
-stable branchs to send it to.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usbnet: cleanup after bind() in probe()
[not found] ` <20160307.114125.198056880799710267.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
@ 2016-03-07 17:36 ` Oliver Neukum
0 siblings, 0 replies; 3+ messages in thread
From: Oliver Neukum @ 2016-03-07 17:36 UTC (permalink / raw)
To: David Miller
Cc: andreyknvl-Re5JQEeQqe8AvxtiuMwx3w, bjorn-yOkvZcmFvRU,
linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
On Mon, 2016-03-07 at 11:41 -0500, David Miller wrote:
> From: Oliver Neukum <oneukum-IBi9RG/b67k@public.gmane.org>
> Date: Mon, 7 Mar 2016 11:31:10 +0100
>
> > 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-IBi9RG/b67k@public.gmane.org>
>
> Applied, thanks Oliver.
>
> How far back does this bug exist? I'm trying to figure out what
> -stable branchs to send it to.
It goes back to 3.12
HTH
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-07 17:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-07 10:31 [PATCH] usbnet: cleanup after bind() in probe() Oliver Neukum
2016-03-07 16:41 ` David Miller
[not found] ` <20160307.114125.198056880799710267.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2016-03-07 17:36 ` Oliver Neukum
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).