From: Johan Hovold <johan@kernel.org>
To: Oliver Neukum <oneukum@suse.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
Oleksij Rempel <linux@rempel-privat.de>,
Dongliang Mu <dzm91@hust.edu.cn>,
Oliver Neukum <oliver@neukum.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Dongliang Mu <mudongliangabcd@gmail.com>,
syzbot+eabbf2aaa999cc507108@syzkaller.appspotmail.com,
USB <linux-usb@vger.kernel.org>, netdev <netdev@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] driver: usb: nullify dangling pointer in cdc_ncm_free
Date: Wed, 20 Apr 2022 12:06:43 +0200 [thread overview]
Message-ID: <Yl/bMxXKeNdLI87G@hovoldconsulting.com> (raw)
In-Reply-To: <aef0c568-e088-b897-f8ec-f22cfef124f6@suse.com>
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
next prev parent reply other threads:[~2022-04-20 10:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-09 12:09 [PATCH] driver: usb: nullify dangling pointer in cdc_ncm_free Dongliang Mu
2022-04-11 12:14 ` Johan Hovold
2022-04-14 13:58 ` Dongliang Mu
2022-04-14 14:03 ` Dongliang Mu
2022-04-14 15:01 ` Andy Shevchenko
2022-04-15 7:19 ` Oleksij Rempel
2022-04-19 11:47 ` Oliver Neukum
2022-04-19 20:25 ` Bjørn Mork
2022-04-20 6:56 ` Johan Hovold
2022-04-20 9:45 ` Oliver Neukum
2022-04-20 10:06 ` Johan Hovold [this message]
2022-04-21 11:18 ` Oliver Neukum
2022-04-11 14:51 ` Andy Shevchenko
2022-04-14 13:59 ` Dongliang Mu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yl/bMxXKeNdLI87G@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=andy.shevchenko@gmail.com \
--cc=davem@davemloft.net \
--cc=dzm91@hust.edu.cn \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@rempel-privat.de \
--cc=mudongliangabcd@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=oliver@neukum.org \
--cc=oneukum@suse.com \
--cc=pabeni@redhat.com \
--cc=syzbot+eabbf2aaa999cc507108@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox