* [patch]fix dma on stack in usbtouchscreen
@ 2008-04-04 12:31 Oliver Neukum
0 siblings, 0 replies; only message in thread
From: Oliver Neukum @ 2008-04-04 12:31 UTC (permalink / raw)
To: daniel.ritz-OI3hZJvNYWs, Dmitry Torokhov, Jiri Kosina,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-usb-u79uwXL29TY76Z2rM5mHXA
DMA on the stack is not allowed. The buffer must be kmalloced.
Signed-off-by: Oliver Neukum <oneukum-l3A5Bk7waGM@public.gmane.org>
---
--- linux-2.6.25-rc7-vanilla/drivers/input/touchscreen/usbtouchscreen.c 2008-03-31 15:16:40.000000000 +0200
+++ linux-2.6.25-rc7-work/drivers/input/touchscreen/usbtouchscreen.c 2008-04-04 14:19:07.000000000 +0200
@@ -396,9 +396,12 @@ static int gunze_read_data(struct usbtou
static int dmc_tsc10_init(struct usbtouch_usb *usbtouch)
{
struct usb_device *dev = usbtouch->udev;
- int ret;
- unsigned char buf[2];
+ int ret = -ENOMEM;
+ unsigned char *buf;
+ buf = kmalloc(2, GFP_KERNEL);
+ if (!buf)
+ goto err_nobuf;
/* reset */
buf[0] = buf[1] = 0xFF;
ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0),
@@ -406,9 +409,11 @@ static int dmc_tsc10_init(struct usbtouc
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, 0, buf, 2, USB_CTRL_SET_TIMEOUT);
if (ret < 0)
- return ret;
- if (buf[0] != 0x06 || buf[1] != 0x00)
- return -ENODEV;
+ goto err_out;
+ if (buf[0] != 0x06 || buf[1] != 0x00) {
+ ret = -ENODEV;
+ goto err_out;
+ }
/* set coordinate output rate */
buf[0] = buf[1] = 0xFF;
@@ -417,20 +422,22 @@ static int dmc_tsc10_init(struct usbtouc
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
TSC10_RATE_150, 0, buf, 2, USB_CTRL_SET_TIMEOUT);
if (ret < 0)
- return ret;
+ goto err_out;
if ((buf[0] != 0x06 || buf[1] != 0x00) &&
- (buf[0] != 0x15 || buf[1] != 0x01))
- return -ENODEV;
+ (buf[0] != 0x15 || buf[1] != 0x01)) {
+ ret = -ENODEV;
+ goto err_out;
+ }
/* start sending data */
ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0),
TSC10_CMD_DATA1,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
- if (ret < 0)
- return ret;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-04-04 12:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-04 12:31 [patch]fix dma on stack in usbtouchscreen Oliver Neukum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).