All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Young <sean@mess.org>
To: Laurent Caumont <lcaumont2@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>,
	linux-media@vger.kernel.org
Subject: Re: 'LITE-ON USB2.0 DVB-T Tune' driver crash with kernel 4.13 / ubuntu 17.10
Date: Sat, 11 Nov 2017 20:55:27 +0000	[thread overview]
Message-ID: <20171111205527.g5dach2rmhlxmr5x@gofer.mess.org> (raw)
In-Reply-To: <CACG2uryHHu-vvHj0B1wGRYZuczB5_8cbD3LBscaBmbN-LFJQMg@mail.gmail.com>

Hi Laurant,

On Sat, Nov 11, 2017 at 08:06:38PM +0100, Laurent Caumont wrote:
> Hi Sean,
> 
> I hope this one will be okay.

There is a memory leak in there, and there is no reason to have to kmallocs
for this function. Please would you mind testing this version?

Please note that there were other issues like whitespace which I've fixed
up.

Thanks,
Sean
----
>From 8362bc3e95016944b173c3866c103fcbc2587b6d 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 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>
---
 drivers/media/usb/dvb-usb/dibusb-common.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c
index 8207e6900656..bcacb0f22028 100644
--- a/drivers/media/usb/dvb-usb/dibusb-common.c
+++ b/drivers/media/usb/dvb-usb/dibusb-common.c
@@ -223,8 +223,20 @@ 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 *buf;
+	int rc;
+
+	buf = kmalloc(2, GFP_KERNEL);
+	if (!buf)
+		return -ENOMEM;
+
+	buf[0] = offs;
+
+	rc = dibusb_i2c_msg(d, 0x50, &buf[0], 1, &buf[1], 1);
+	*val = buf[1];
+	kfree(buf);
+
+	return rc;
 }
 EXPORT_SYMBOL(dibusb_read_eeprom_byte);
 
-- 
2.13.6

  reply	other threads:[~2017-11-11 20:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-22 17:49 'LITE-ON USB2.0 DVB-T Tune' driver crash with kernel 4.13 / ubuntu 17.10 Laurent Caumont
2017-10-23  9:43 ` Sean Young
     [not found]   ` <CACG2urzPV2q63-bLP98cHDDqzP3a-oydDScPqG=tVKSCzxREBg@mail.gmail.com>
2017-10-23 18:57     ` Sean Young
2017-10-29 17:54       ` Laurent Caumont
2017-10-29 19:31         ` Sean Young
2017-10-30 20:59           ` Laurent Caumont
2017-11-07 10:15             ` Sean Young
2017-11-07 10:42             ` Mauro Carvalho Chehab
2017-11-10 20:33               ` Laurent Caumont
2017-11-11 10:56                 ` Sean Young
2017-11-11 17:53                   ` Laurent Caumont
2017-11-11 18:01                     ` Sean Young
2017-11-11 19:06                       ` Laurent Caumont
2017-11-11 20:55                         ` Sean Young [this message]
2017-11-12  8:38                           ` Laurent Caumont
2017-11-12 21:06                             ` Sean Young
2017-11-21 21:03                             ` Sean Young
2017-11-21 22:44                               ` Laurent Caumont

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171111205527.g5dach2rmhlxmr5x@gofer.mess.org \
    --to=sean@mess.org \
    --cc=lcaumont2@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@s-opensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.