media: stk1160: Avoid stack-allocated buffer for control URBs
authorEzequiel Garcia <ezequiel.garcia@free-electrons.com>
Thu, 17 Apr 2014 12:28:20 +0000 (09:28 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Jul 2014 03:09:44 +0000 (20:09 -0700)
commit50f865a928e13c8c5de0b8d3443387ea526b1da9
treebd3ebe0d464d4b8b596e9653d5d33e62597f800b
parente48fee81d3ea8bc59d8fa8020fcd8077d3e12fe8
media: stk1160: Avoid stack-allocated buffer for control URBs

commit 85ac1a1772bb41da895bad83a81f6a62c8f293f6 upstream.

Currently stk1160_read_reg() uses a stack-allocated char to get the
read control value. This is wrong because usb_control_msg() requires
a kmalloc-ed buffer.

This commit fixes such issue by kmalloc'ating a 1-byte buffer to receive
the read value.

While here, let's remove the urb_buf array which was meant for a similar
purpose, but never really used.

Cc: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/usb/stk1160/stk1160-core.c
drivers/media/usb/stk1160/stk1160.h