drivers/net/usb/usbnet.c | 3 +++ 1 file changed, 3 insertions(+)
The root cause of this issue are:
1. When probing the usbnet device, executing usbnet_link_change(dev, 0, 0);
places the kevent in the waitqueue. However, the kevent has not yet been
scheduled when the usbnet device is unregistered. Therefore, executing
free_netdev() results in the "free active object (kevent)" error reported
here.
2. Another factor is that when calling usbnet_disconnect()->unregister_netdev(),
if the usbnet device is up, ndo_stop() is executed to cancel the kevent.
However, because the device is not up, ndo_stop() is not executed.
The solution to this problem is to cancel the kevent before executing
free_netdev(), which also deletes the delay timer.
Reported-by: Sam Sun <samsun1006219@gmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=8bfd7bcc98f7300afb84
Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
---
drivers/net/usb/usbnet.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index bf01f2728531..f0294f0e6612 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1672,6 +1672,9 @@ void usbnet_disconnect (struct usb_interface *intf)
usb_free_urb(dev->interrupt);
kfree(dev->padding_pkt);
+ cancel_work_sync(&dev->kevent);
+ timer_delete_sync(&dev->delay);
+
free_netdev(net);
}
EXPORT_SYMBOL_GPL(usbnet_disconnect);
--
2.43.0
The root cause of this issue are:
1. When probing the usbnet device, executing usbnet_link_change(dev, 0, 0);
put the kevent work in global workqueue. However, the kevent has not yet
been scheduled when the usbnet device is unregistered. Therefore, executing
free_netdev() results in the "free active object (kevent)" error reported
here.
2. Another factor is that when calling usbnet_disconnect()->unregister_netdev(),
if the usbnet device is up, ndo_stop() is executed to cancel the kevent.
However, because the device is not up, ndo_stop() is not executed.
The solution to this problem is to cancel the kevent before executing
free_netdev(), which also deletes the delay timer.
Reported-by: Sam Sun <samsun1006219@gmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=8bfd7bcc98f7300afb84
Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
---
V1 -> V2: update comments for typos
drivers/net/usb/usbnet.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index bf01f2728531..f0294f0e6612 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1672,6 +1672,9 @@ void usbnet_disconnect (struct usb_interface *intf)
usb_free_urb(dev->interrupt);
kfree(dev->padding_pkt);
+ cancel_work_sync(&dev->kevent);
+ timer_delete_sync(&dev->delay);
+
free_netdev(net);
}
EXPORT_SYMBOL_GPL(usbnet_disconnect);
--
2.43.0
On Fri, 17 Oct 2025 17:05:41 +0800 Lizhi Xu wrote: > The root cause of this issue are: > 1. When probing the usbnet device, executing usbnet_link_change(dev, 0, 0); > put the kevent work in global workqueue. However, the kevent has not yet > been scheduled when the usbnet device is unregistered. Therefore, executing > free_netdev() results in the "free active object (kevent)" error reported > here. > > 2. Another factor is that when calling usbnet_disconnect()->unregister_netdev(), > if the usbnet device is up, ndo_stop() is executed to cancel the kevent. > However, because the device is not up, ndo_stop() is not executed. > > The solution to this problem is to cancel the kevent before executing > free_netdev(), which also deletes the delay timer. Please add a fixes tag, and repost. Please don't send new versions in reply to previous / existing threads. Please read at least the tl;dr of: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html -- pw-bot: cr
On Fri, 17 Oct 2025 15:27:31 -0700, Jakub Kicinski wrote:
> On Fri, 17 Oct 2025 17:05:41 +0800 Lizhi Xu wrote:
> > The root cause of this issue are:
> > 1. When probing the usbnet device, executing usbnet_link_change(dev, 0, 0);
> > put the kevent work in global workqueue. However, the kevent has not yet
> > been scheduled when the usbnet device is unregistered. Therefore, executing
> > free_netdev() results in the "free active object (kevent)" error reported
> > here.
> >
> > 2. Another factor is that when calling usbnet_disconnect()->unregister_netdev(),
> > if the usbnet device is up, ndo_stop() is executed to cancel the kevent.
> > However, because the device is not up, ndo_stop() is not executed.
> >
> > The solution to this problem is to cancel the kevent before executing
> > free_netdev(), which also deletes the delay timer.
>
> Please add a fixes tag, and repost.
Fixes: a69e617e533e ("usbnet: Fix linkwatch use-after-free on disconnect")
Later, I will repost new version patch in a new thread
and at the correct time.
BR,
Lizhi
© 2016 - 2026 Red Hat, Inc.