summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMalcolm Priestley <tvboxspy@gmail.com>2017-04-22 10:14:58 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-05-20 12:28:35 (GMT)
commit3eff228fdd43a9d5f242c6a8e5d69a1cb68a27eb (patch)
treec349756436c90d0f5a0ac68f0467338b9f321846 /drivers
parent6312a84dc8b5896efbbb4255061bf6b3b6c5922d (diff)
downloadlinux-3eff228fdd43a9d5f242c6a8e5d69a1cb68a27eb.tar.xz
staging: vt6656: use off stack for in buffer USB transfers.
commit 05c0cf88bec588a7cb34de569acd871ceef26760 upstream. Since 4.9 mandated USB buffers to be heap allocated. This causes the driver to fail. Create buffer for USB transfers. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/vt6656/usbpipe.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index e9b6b21..1c7eca7 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -75,15 +75,28 @@ int vnt_control_in(struct vnt_private *priv, u8 request, u16 value,
u16 index, u16 length, u8 *buffer)
{
int status;
+ u8 *usb_buffer;
if (test_bit(DEVICE_FLAGS_DISCONNECTED, &priv->flags))
return STATUS_FAILURE;
mutex_lock(&priv->usb_lock);
+ usb_buffer = kmalloc(length, GFP_KERNEL);
+ if (!usb_buffer) {
+ mutex_unlock(&priv->usb_lock);
+ return -ENOMEM;
+ }
+
status = usb_control_msg(priv->usb,
- usb_rcvctrlpipe(priv->usb, 0), request, 0xc0, value,
- index, buffer, length, USB_CTL_WAIT);
+ usb_rcvctrlpipe(priv->usb, 0),
+ request, 0xc0, value,
+ index, usb_buffer, length, USB_CTL_WAIT);
+
+ if (status == length)
+ memcpy(buffer, usb_buffer, length);
+
+ kfree(usb_buffer);
mutex_unlock(&priv->usb_lock);