[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <60a08f2c-6475-4bb2-1cc8-1935a5ddeb79@suse.com>
Date: Tue, 14 Jun 2022 12:48:23 +0200
From: Oliver Neukum <oneukum@...e.com>
To: Lukas Wunner <lukas@...ner.de>, Oliver Neukum <oneukum@...e.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>
Cc: netdev@...r.kernel.org, linux-usb@...r.kernel.org,
Dan Williams <dan.j.williams@...el.com>
Subject: Re: [PATCH net] sierra_net: Fix use-after-free on unbind
On 14.06.22 10:50, Lukas Wunner wrote:
> @@ -758,6 +758,8 @@ static void sierra_net_unbind(struct usbnet *dev, struct usb_interface *intf)
>
> dev_dbg(&dev->udev->dev, "%s", __func__);
>
> + usbnet_status_stop(dev);
> +
> /* kill the timer and work */
> del_timer_sync(&priv->sync_timer);
> cancel_work_sync(&priv->sierra_net_kevent);
Hi,
as far as I can see the following race condition exists:
CPU A:
intr_complete() -> static void sierra_net_status() -> defer_kevent()
CPU B:
usbnet_stop_status() ---- kills the URB but only the URB, kevent scheduled
CPU A:
sierra_net_kevent -> sierra_net_dosync() ->
CPU B:
-> del_timer_sync(&priv->sync_timer); ---- NOP, too early
CPU A:
add_timer(&priv->sync_timer);
CPU B:
cancel_work_sync(&priv->sierra_net_kevent); ---- NOP, too late
Regards
Oliver
Powered by blists - more mailing lists