[4/8] pcwd_usb: do not leave a freed URB active

Message ID 20230427133350.31064-5-oneukum@suse.com
State New
Headers
Series [1/8] pwcd_usb: fix error handling in probe |

Commit Message

Oliver Neukum April 27, 2023, 1:33 p.m. UTC
  Fix disconnect so that the URB is killed.
Not doing so leaves this to error handling
in the case of physical disconnect.
This fixes the case of a soft disconnect
and prevents multiple accesses to freed
memory.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/watchdog/pcwd_usb.c | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
index ed3be8926a15..fe58ec84ce8c 100644
--- a/drivers/watchdog/pcwd_usb.c
+++ b/drivers/watchdog/pcwd_usb.c
@@ -815,6 +815,7 @@  static void usb_pcwd_disconnect(struct usb_interface *interface)
 
 	/* We should now stop communicating with the USB PCWD device */
 	usb_pcwd->exists = 0;
+	usb_kill_urb(usb_pcwd->intr_urb);
 
 	/* Deregister */
 	misc_deregister(&usb_pcwd_miscdev);