patch "USB: usbtmc: fix probe error path" added to usb-linus
Subsystems (2)
This is a note to let you know that I've just added the patch titled
USB: usbtmc: fix probe error path
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.
Quoted 1 line
From
2e47c53503eb9faff42b3cfa144a833344dd1f89Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Tue, 14 Mar 2017 17:55:46 +0100
Subject: USB: usbtmc: fix probe error path
Make sure to initialise the return value to avoid having allocation failures going unnoticed when allocating interrupt-endpoint resources.
This prevents use-after-free or worse when the device is later unbound.
--- drivers/usb/class/usbtmc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/class/usbtmc.c +6 -2
@@ -1476,8 +1476,10 @@ static int usbtmc_probe(struct usb_interface *intf,if (data->iin_ep_present) {/* allocate int urb */ data->iin_urb =usb_alloc_urb (0 ,GFP_KERNEL ); -if (!data->iin_urb) +if (!data->iin_urb) { + retcode = -ENOMEM ; goto error_register; + }/* Protect interrupt in endpoint data until iin_urb is freed */ kref_get (&data->kref);
@@ -1485,8 +1487,10 @@ static int usbtmc_probe(struct usb_interface *intf,/* allocate buffer for interrupt in */ data->iin_buffer =kmalloc (data->iin_wMaxPacketSize,GFP_KERNEL ); -if (!data->iin_buffer) +if (!data->iin_buffer) { + retcode = -ENOMEM ; goto error_register; + }/* fill interrupt urb */ usb_fill_int_urb(data->iin_urb, data->usb_dev,
Signature · 1 line
2.12.0