USB: iowarrior: fix use-after-free on disconnect
Subsystems (2)
PATCH 1/1 USB: iowarrior: fix use-after-free on disconnect
Submitted write URBs are not stopped on close() and therefore need to be stopped unconditionally on disconnect() to avoid use-after-free in the completion handler.
---
I happened to see a reply to this syzbot report today and took at look at the driver. Turns out my fix from 2019 was incomplete.
Johan
drivers/usb/misc/iowarrior.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/misc/iowarrior.c +3 -1
@@ -905,13 +905,15 @@ static void iowarrior_disconnect(struct usb_interface *interface)/* prevent device read, write and ioctl */ dev->present =0 ; +/* write urbs are not stopped on close() so kill unconditionally */ +usb_kill_anchored_urbs (&dev->submitted); +if (dev->opened) {/* There is a process that holds a filedescriptor to the device , so we only shutdown read-/write-ops going on. Deleting the device is postponed until close() was called. */ usb_kill_urb (dev->int_in_urb); -usb_kill_anchored_urbs (&dev->submitted);wake_up_interruptible (&dev->read_wait);wake_up_interruptible (&dev->write_wait);mutex_unlock (&dev->mutex);
Signature · 1 line
2.53.0
Quoted 11 lines · Johan Hovold
Submitted write URBs are not stopped on
close()and therefore need to be stopped unconditionally ondisconnect()to avoid use-after-free in the completion handler.Fixes b5f8d46867ca ("USB: iowarrior: fix use-after-free after driver unbind")Fixes 946b960d13c1 ("USB: add driver for iowarrior devices.")Reported-by [email protected]Signed-off-by Johan Hovold <[email protected]>---
Quoted 13 lines · Greg Kroah-Hartman
Quoted 11 lines · Johan Hovold
Submitted write URBs are not stopped on
close()and therefore need to be stopped unconditionally ondisconnect()to avoid use-after-free in the completion handler.Fixes b5f8d46867ca ("USB: iowarrior: fix use-after-free after driver unbind")Fixes 946b960d13c1 ("USB: add driver for iowarrior devices.")Reported-by [email protected]Signed-off-by Johan Hovold <[email protected]>---
Quoted 1 line
Reviewed-by Greg Kroah-Hartman <[email protected]>
Someone else just sent a fix for this so sending a reminder about this one in case there was some confusion about who was going to pick it up.
Can be queued after rc1 is out too of course.
Johan