Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: dvb: i2c transfers over usb cannot be done from stack

Cc: stable@vger.kernel.org
Signed-off-by: Laurent Caumont <lcaumont2@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Laurent Caumont and committed by
Mauro Carvalho Chehab
6d33377f be9b53c8

+14 -2
+14 -2
drivers/media/usb/dvb-usb/dibusb-common.c
··· 223 223 224 224 int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val) 225 225 { 226 - u8 wbuf[1] = { offs }; 227 - return dibusb_i2c_msg(d, 0x50, wbuf, 1, val, 1); 226 + u8 *buf; 227 + int rc; 228 + 229 + buf = kmalloc(2, GFP_KERNEL); 230 + if (!buf) 231 + return -ENOMEM; 232 + 233 + buf[0] = offs; 234 + 235 + rc = dibusb_i2c_msg(d, 0x50, &buf[0], 1, &buf[1], 1); 236 + *val = buf[1]; 237 + kfree(buf); 238 + 239 + return rc; 228 240 } 229 241 EXPORT_SYMBOL(dibusb_read_eeprom_byte); 230 242