Commit 401711cb authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: visor: fix DMA buffers on stack

Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d2126326
...@@ -807,10 +807,14 @@ static int clie_3_5_startup(struct usb_serial *serial) ...@@ -807,10 +807,14 @@ static int clie_3_5_startup(struct usb_serial *serial)
{ {
struct device *dev = &serial->dev->dev; struct device *dev = &serial->dev->dev;
int result; int result;
u8 data; u8 *data;
dbg("%s", __func__); dbg("%s", __func__);
data = kmalloc(1, GFP_KERNEL);
if (!data)
return -ENOMEM;
/* /*
* Note that PEG-300 series devices expect the following two calls. * Note that PEG-300 series devices expect the following two calls.
*/ */
...@@ -818,36 +822,42 @@ static int clie_3_5_startup(struct usb_serial *serial) ...@@ -818,36 +822,42 @@ static int clie_3_5_startup(struct usb_serial *serial)
/* get the config number */ /* get the config number */
result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
USB_REQ_GET_CONFIGURATION, USB_DIR_IN, USB_REQ_GET_CONFIGURATION, USB_DIR_IN,
0, 0, &data, 1, 3000); 0, 0, data, 1, 3000);
if (result < 0) { if (result < 0) {
dev_err(dev, "%s: get config number failed: %d\n", dev_err(dev, "%s: get config number failed: %d\n",
__func__, result); __func__, result);
return result; goto out;
} }
if (result != 1) { if (result != 1) {
dev_err(dev, "%s: get config number bad return length: %d\n", dev_err(dev, "%s: get config number bad return length: %d\n",
__func__, result); __func__, result);
return -EIO; result = -EIO;
goto out;
} }
/* get the interface number */ /* get the interface number */
result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
USB_REQ_GET_INTERFACE, USB_REQ_GET_INTERFACE,
USB_DIR_IN | USB_RECIP_INTERFACE, USB_DIR_IN | USB_RECIP_INTERFACE,
0, 0, &data, 1, 3000); 0, 0, data, 1, 3000);
if (result < 0) { if (result < 0) {
dev_err(dev, "%s: get interface number failed: %d\n", dev_err(dev, "%s: get interface number failed: %d\n",
__func__, result); __func__, result);
return result; goto out;
} }
if (result != 1) { if (result != 1) {
dev_err(dev, dev_err(dev,
"%s: get interface number bad return length: %d\n", "%s: get interface number bad return length: %d\n",
__func__, result); __func__, result);
return -EIO; result = -EIO;
goto out;
} }
return generic_startup(serial); result = generic_startup(serial);
out:
kfree(data);
return result;
} }
static int treo_attach(struct usb_serial *serial) static int treo_attach(struct usb_serial *serial)
......
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