Commit 6c4624d7 authored by Johan Hovold's avatar Johan Hovold Committed by Khalid Elmously

USB: iowarrior: fix use-after-free on release

BugLink: https://bugs.launchpad.net/bugs/1848780

commit 80cd5479 upstream.

The driver was accessing its struct usb_interface from its release()
callback without holding a reference. This would lead to a
use-after-free whenever debugging was enabled and the device was
disconnected while its character device was open.

Fixes: 549e8350 ("USB: iowarrior: Convert local dbg macro to dev_dbg")
Cc: stable <stable@vger.kernel.org>     # 3.16
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20191009104846.5925-3-johan@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 4c30cc28
...@@ -248,6 +248,7 @@ static inline void iowarrior_delete(struct iowarrior *dev) ...@@ -248,6 +248,7 @@ static inline void iowarrior_delete(struct iowarrior *dev)
kfree(dev->int_in_buffer); kfree(dev->int_in_buffer);
usb_free_urb(dev->int_in_urb); usb_free_urb(dev->int_in_urb);
kfree(dev->read_queue); kfree(dev->read_queue);
usb_put_intf(dev->interface);
kfree(dev); kfree(dev);
} }
...@@ -782,7 +783,7 @@ static int iowarrior_probe(struct usb_interface *interface, ...@@ -782,7 +783,7 @@ static int iowarrior_probe(struct usb_interface *interface,
init_waitqueue_head(&dev->write_wait); init_waitqueue_head(&dev->write_wait);
dev->udev = udev; dev->udev = udev;
dev->interface = interface; dev->interface = usb_get_intf(interface);
iface_desc = interface->cur_altsetting; iface_desc = interface->cur_altsetting;
dev->product_id = le16_to_cpu(udev->descriptor.idProduct); dev->product_id = le16_to_cpu(udev->descriptor.idProduct);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment