mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Florian Mickler <florian@mickler.org>
To: mchehab@infradead.org
Cc: tino.keitel@tikei.de, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Florian Mickler <florian@mickler.org>,
	"v3.0.y" <stable@kernel.org>
Subject: [PATCH] [media] vp7045: fix buffer setup
Date: Wed, 10 Aug 2011 12:05:20 +0200	[thread overview]
Message-ID: <1312970720-25694-1-git-send-email-florian@mickler.org> (raw)
In-Reply-To: <20110809200842.GA29662@mac.home>

dvb_usb_device_init calls the frontend_attach method of this driver which
uses vp7045_usb_ob. In order to have a buffer ready in vp7045_usb_op, it has to
be allocated before that happens.

Luckily we can use the whole private data as the buffer as it gets separately
allocated on the heap via kzalloc in dvb_usb_device_init and is thus apt for
use via usb_control_msg.

This fixes a
	BUG: unable to handle kernel paging request at 0000000000001e78

reported by Tino Keitel and diagnosed by Dan Carpenter.

References: https://bugzilla.kernel.org/show_bug.cgi?id=40062
Cc: v3.0.y <stable@kernel.org>
Tested-by: Tino Keitel <tino.keitel@tikei.de>
Signed-off-by: Florian Mickler <florian@mickler.org>
---
 drivers/media/dvb/dvb-usb/vp7045.c |   26 ++++----------------------
 1 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c
index 3db89e3..536c16c 100644
--- a/drivers/media/dvb/dvb-usb/vp7045.c
+++ b/drivers/media/dvb/dvb-usb/vp7045.c
@@ -224,26 +224,8 @@ static struct dvb_usb_device_properties vp7045_properties;
 static int vp7045_usb_probe(struct usb_interface *intf,
 		const struct usb_device_id *id)
 {
-	struct dvb_usb_device *d;
-	int ret = dvb_usb_device_init(intf, &vp7045_properties,
-				   THIS_MODULE, &d, adapter_nr);
-	if (ret)
-		return ret;
-
-	d->priv = kmalloc(20, GFP_KERNEL);
-	if (!d->priv) {
-		dvb_usb_device_exit(intf);
-		return -ENOMEM;
-	}
-
-	return ret;
-}
-
-static void vp7045_usb_disconnect(struct usb_interface *intf)
-{
-	struct dvb_usb_device *d = usb_get_intfdata(intf);
-	kfree(d->priv);
-	dvb_usb_device_exit(intf);
+	return dvb_usb_device_init(intf, &vp7045_properties,
+				   THIS_MODULE, NULL, adapter_nr);
 }
 
 static struct usb_device_id vp7045_usb_table [] = {
@@ -258,7 +240,7 @@ MODULE_DEVICE_TABLE(usb, vp7045_usb_table);
 static struct dvb_usb_device_properties vp7045_properties = {
 	.usb_ctrl = CYPRESS_FX2,
 	.firmware = "dvb-usb-vp7045-01.fw",
-	.size_of_priv = sizeof(u8 *),
+	.size_of_priv = 20,
 
 	.num_adapters = 1,
 	.adapter = {
@@ -305,7 +287,7 @@ static struct dvb_usb_device_properties vp7045_properties = {
 static struct usb_driver vp7045_usb_driver = {
 	.name		= "dvb_usb_vp7045",
 	.probe		= vp7045_usb_probe,
-	.disconnect	= vp7045_usb_disconnect,
+	.disconnect	= dvb_usb_device_exit,
 	.id_table	= vp7045_usb_table,
 };
 
-- 
1.7.6


  parent reply	other threads:[~2011-08-10 10:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-22 19:27 USB related "unable to handle kernel paging request" in 3.0.0-rc7 Tino Keitel
2011-07-25 19:47 ` Maciej Rutecki
2011-08-02  8:54 ` Dan Carpenter
2011-08-02  9:51   ` Florian Mickler
2011-08-02 10:40     ` Florian Mickler
2011-08-02 11:10       ` Florian Mickler
2011-08-02 11:51         ` Florian Mickler
2011-08-02 11:56           ` Dan Carpenter
2011-08-02 11:35       ` Dan Carpenter
2011-08-02 11:40         ` Dan Carpenter
2011-08-02 12:02         ` Florian Mickler
2011-08-02 12:29 ` [PATCH] [media] vp7045: fix buffer setup Florian Mickler
2011-08-03 19:02   ` Tino Keitel
2011-08-09 20:08     ` Tino Keitel
2011-08-10  9:46       ` Florian Mickler
2011-08-10 10:05       ` Florian Mickler [this message]
2011-08-19 16:35         ` Florian Mickler
2011-08-24 16:26           ` Tino Keitel

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=1312970720-25694-1-git-send-email-florian@mickler.org \
    --to=florian@mickler.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=stable@kernel.org \
    --cc=tino.keitel@tikei.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®