This Linux kernel change "USB: yurex: Fix protection fault after device removal" is included in the Linux 3.16.72 release. This change is authored by Alan Stern <stern [at] rowland.harvard.edu> on Tue Apr 23 14:48:29 2019 -0400. The commit for this change in Linux stable tree is 5133454 (patch) which is from upstream commit ef61eb4. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream ef61eb4.
USB: yurex: Fix protection fault after device removal commit ef61eb43ada6c1d6b94668f0f514e4c268093ff3 upstream. The syzkaller USB fuzzer found a general-protection-fault bug in the yurex driver. The fault occurs when a device has been unplugged; the driver's interrupt-URB handler logs an error message referring to the device by name, after the device has been unregistered and its name deallocated. This problem is caused by the fact that the interrupt URB isn't cancelled until the driver's private data structure is released, which can happen long after the device is gone. The cure is to make sure that the interrupt URB is killed before yurex_disconnect() returns; this is exactly the sort of thing that usb_poison_urb() was meant for. Signed-off-by: Alan Stern <firstname.lastname@example.org> Reported-and-tested-by: email@example.com Signed-off-by: Greg Kroah-Hartman <firstname.lastname@example.org> Signed-off-by: Ben Hutchings <email@example.com>
There is one line of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.
drivers/usb/misc/yurex.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index 3114c8d..1c9d081 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c @@ -332,6 +332,7 @@ static void yurex_disconnect(struct usb_interface *interface) usb_deregister_dev(interface, &yurex_class); /* prevent more I/O from starting */ + usb_poison_urb(dev->urb); mutex_lock(&dev->io_mutex); dev->interface = NULL; mutex_unlock(&dev->io_mutex);