diff options
author | Oliver Neukum <oneukum@suse.com> | 2024-09-19 14:33:42 +0200 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2024-09-26 10:54:42 +0200 |
commit | 04e906839a053f092ef53f4fb2d610983412b904 (patch) | |
tree | bc2d0f895a7f8203432c61255e0bb8b148549c16 /include | |
parent | net: stmmac: set PP_FLAG_DMA_SYNC_DEV only if XDP is enabled (diff) | |
download | linux-04e906839a053f092ef53f4fb2d610983412b904.tar.xz linux-04e906839a053f092ef53f4fb2d610983412b904.zip |
usbnet: fix cyclical race on disconnect with work queue
The work can submit URBs and the URBs can schedule the work.
This cycle needs to be broken, when a device is to be stopped.
Use a flag to do so.
This is a design issue as old as the driver.
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
CC: stable@vger.kernel.org
Link: https://patch.msgid.link/20240919123525.688065-1-oneukum@suse.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/usb/usbnet.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 9f08a584d707..0b9f1e598e3a 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -76,8 +76,23 @@ struct usbnet { # define EVENT_LINK_CHANGE 11 # define EVENT_SET_RX_MODE 12 # define EVENT_NO_IP_ALIGN 13 +/* This one is special, as it indicates that the device is going away + * there are cyclic dependencies between tasklet, timer and bh + * that must be broken + */ +# define EVENT_UNPLUG 31 }; +static inline bool usbnet_going_away(struct usbnet *ubn) +{ + return test_bit(EVENT_UNPLUG, &ubn->flags); +} + +static inline void usbnet_mark_going_away(struct usbnet *ubn) +{ + set_bit(EVENT_UNPLUG, &ubn->flags); +} + static inline struct usb_driver *driver_of(struct usb_interface *intf) { return to_usb_driver(intf->dev.driver); |