Skip to content

Commit d212632

Browse files
jhovoldgregkh
authored andcommitted
USB: oti6858: fix DMA buffer on stack
Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 9e221a3 commit d212632

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎drivers/usb/serial/oti6858.c‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ void send_data(struct work_struct *work)
302302
struct usb_serial_port *port = priv->port;
303303
int count = 0, result;
304304
unsigned long flags;
305-
unsigned char allow;
305+
u8 *allow;
306306

307307
dbg("%s(port = %d)", __func__, port->number);
308308

@@ -321,13 +321,20 @@ void send_data(struct work_struct *work)
321321
count = port->bulk_out_size;
322322

323323
if (count != 0) {
324+
allow = kmalloc(1, GFP_KERNEL);
325+
if (!allow) {
326+
dev_err(&port->dev, "%s(): kmalloc failed\n",
327+
__func__);
328+
return;
329+
}
324330
result = usb_control_msg(port->serial->dev,
325331
usb_rcvctrlpipe(port->serial->dev, 0),
326332
OTI6858_REQ_T_CHECK_TXBUFF,
327333
OTI6858_REQ_CHECK_TXBUFF,
328-
count, 0, &allow, 1, 100);
329-
if (result != 1 || allow != 0)
334+
count, 0, allow, 1, 100);
335+
if (result != 1 || *allow != 0)
330336
count = 0;
337+
kfree(allow);
331338
}
332339

333340
if (count == 0) {

0 commit comments

Comments
 (0)