diff mbox

'LITE-ON USB2.0 DVB-T Tune' driver crash with kernel 4.13 / ubuntu 17.10

Message ID CACG2uryHHu-vvHj0B1wGRYZuczB5_8cbD3LBscaBmbN-LFJQMg@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Caumont Nov. 11, 2017, 7:06 p.m. UTC
Hi Sean,

I hope this one will be okay.


2017-11-11 19:01 GMT+01:00 Sean Young <sean@mess.org>:
> Hi Laurent,
>
> On Sat, Nov 11, 2017 at 06:53:54PM +0100, Laurent Caumont wrote:
>> Hi Sean,
>>
>> I just realized that files in media_build/linux/driver are not
>> associate with a git repository. They are retrieved by the build
>> command.
>> So, I cloned the linux-stable repository to generate the patch.
>
> Great, thank you.
>
> We need a Signed-off-by: line to accept your patch, see part 11 of
>
> https://www.kernel.org/doc/html/latest/process/submitting-patches.html
>
> Thanks,
>
> Sean
diff mbox

Patch

From bf48cb8988a0335038e8df1a40f1d1b2cf4225d5 Mon Sep 17 00:00:00 2001
From: Laurent Caumont <lcaumont2@gmail.com>
Date: Sat, 11 Nov 2017 18:44:46 +0100
Subject: [PATCH] media: dvb: i2c transfers over usb - use kmalloc instead
 stack Signed-off-by: Laurent Caumont <lcaumont2@gmail.com>

---
 drivers/media/usb/dvb-usb/dibusb-common.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c
index 8207e690..e1c31381 100644
--- a/drivers/media/usb/dvb-usb/dibusb-common.c
+++ b/drivers/media/usb/dvb-usb/dibusb-common.c
@@ -223,8 +223,26 @@  EXPORT_SYMBOL(dibusb_i2c_algo);
 
 int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val)
 {
-	u8 wbuf[1] = { offs };
-	return dibusb_i2c_msg(d, 0x50, wbuf, 1, val, 1);
+	  u8 *wbuf;
+	  u8 *rbuf;
+	  int rc;
+	  
+	  rbuf = kmalloc(1, GFP_KERNEL);
+	  if (!rbuf)
+	    return -ENOMEM;
+	 
+	  wbuf = kmalloc(1, GFP_KERNEL);
+	  if (!wbuf)
+	    return -ENOMEM;
+	  
+         *wbuf = offs;
+
+	 rc = dibusb_i2c_msg(d, 0x50, wbuf, 1, rbuf, 1);
+         kfree(wbuf);
+	 *val = *rbuf;
+	 kfree(rbuf);
+	  
+	return rc;
 }
 EXPORT_SYMBOL(dibusb_read_eeprom_byte);
 
-- 
2.14.1