lkml.org 
[lkml]   [2022]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] driver: usb: nullify dangling pointer in cdc_ncm_free
On Wed, Apr 20, 2022 at 11:45:49AM +0200, Oliver Neukum wrote:

> >> - if (dev->driver_info->unbind)
> >> - dev->driver_info->unbind(dev, intf);
> >> + if (dev->driver_info->disable)
> >> + dev->driver_info->disable(dev, intf);
> >>
> >> net = dev->net;
> >> unregister_netdev (net);
> >> @@ -1651,6 +1651,9 @@ void usbnet_disconnect (struct usb_interface *intf)
> >>
> >> usb_scuttle_anchored_urbs(&dev->deferred);
> >>
> >> + if (dev->driver_info->unbind)
> >> + dev->driver_info->unbind (dev, intf);
> >> +
> >> usb_kill_urb(dev->interrupt);

> > Don't you need to quiesce all I/O, including stopping the interrupt URB,
> > before unbind?

> If I do that, how do I prevent people from relaunching the URB between
> kill and unbind? Do I need to poison it?

You could, but it would seem you have bigger problems if something can
submit the URB after having deregistered the netdev.

Looks like the URB should already have been stopped by
usbnet_status_stop() so that the usb_kill_urb() above is (or should be)
a noop.

Johan

\
 
 \ /
  Last update: 2022-04-20 12:07    [W:0.066 / U:1.964 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site