patch "USB: usblp: fix use-after-free on disconnect" added to usb-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
USB: usblp: fix use-after-free on disconnect
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From 7a759197974894213621aa65f0571b51904733d6 Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Tue, 15 Oct 2019 19:55:22 +0200
Subject: USB: usblp: fix use-after-free on disconnect
A recent commit addressing a runtime PM use-count regression, introduced a use-after-free by not making sure we held a reference to the struct usb_interface for the lifetime of the driver data.
--- drivers/usb/class/usblp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/class/usblp.c +3 -1
@@ -445,6 +445,7 @@ static void usblp_cleanup(struct usblp *usblp)kfree (usblp->readbuf);kfree (usblp->device_id_string);kfree (usblp->statusbuf); +usb_put_intf (usblp->intf);kfree (usblp); }
@@ -1113,7 +1114,7 @@ static int usblp_probe(struct usb_interface *intf,init_waitqueue_head (&usblp->wwait);init_usb_anchor (&usblp->urbs); usblp->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; - usblp->intf = intf; + usblp->intf =usb_get_intf (intf);/* Malloc device ID string buffer to the largest expected length, * since we can re-query it on an ioctl and a dynamic string
@@ -1198,6 +1199,7 @@ static int usblp_probe(struct usb_interface *intf,kfree (usblp->readbuf);kfree (usblp->statusbuf);kfree (usblp->device_id_string); +usb_put_intf (usblp->intf);kfree (usblp); abort_ret:return retval;
Signature · 1 line
2.23.0