aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorFlorian Mickler <florian@mickler.org>2011-08-10 06:05:20 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-09-11 08:33:41 -0400
commitfc61ccd35fd59d5362d37c8bf9c0526c85086c84 (patch)
treeef4a47ba5424d8b20637c0bdba47f5005835c6d7 /drivers/media
parentde4ed0c111ed078b8729a5cc49c23197740f5bad (diff)
[media] vp7045: fix buffer setup
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. Cc: stable@kernel.org # For v3.0 and upper Tested-by: Tino Keitel <tino.keitel@tikei.de> Signed-off-by: Florian Mickler <florian@mickler.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-usb/vp7045.c26
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 3db89e3cb0bb..536c16c943bd 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;
224static int vp7045_usb_probe(struct usb_interface *intf, 224static int vp7045_usb_probe(struct usb_interface *intf,
225 const struct usb_device_id *id) 225 const struct usb_device_id *id)
226{ 226{
227 struct dvb_usb_device *d; 227 return dvb_usb_device_init(intf, &vp7045_properties,
228 int ret = dvb_usb_device_init(intf, &vp7045_properties, 228 THIS_MODULE, NULL, adapter_nr);
229 THIS_MODULE, &d, adapter_nr);
230 if (ret)
231 return ret;
232
233 d->priv = kmalloc(20, GFP_KERNEL);
234 if (!d->priv) {
235 dvb_usb_device_exit(intf);
236 return -ENOMEM;
237 }
238
239 return ret;
240}
241
242static void vp7045_usb_disconnect(struct usb_interface *intf)
243{
244 struct dvb_usb_device *d = usb_get_intfdata(intf);
245 kfree(d->priv);
246 dvb_usb_device_exit(intf);
247} 229}
248 230
249static struct usb_device_id vp7045_usb_table [] = { 231static struct usb_device_id vp7045_usb_table [] = {
@@ -258,7 +240,7 @@ MODULE_DEVICE_TABLE(usb, vp7045_usb_table);
258static struct dvb_usb_device_properties vp7045_properties = { 240static struct dvb_usb_device_properties vp7045_properties = {
259 .usb_ctrl = CYPRESS_FX2, 241 .usb_ctrl = CYPRESS_FX2,
260 .firmware = "dvb-usb-vp7045-01.fw", 242 .firmware = "dvb-usb-vp7045-01.fw",
261 .size_of_priv = sizeof(u8 *), 243 .size_of_priv = 20,
262 244
263 .num_adapters = 1, 245 .num_adapters = 1,
264 .adapter = { 246 .adapter = {
@@ -305,7 +287,7 @@ static struct dvb_usb_device_properties vp7045_properties = {
305static struct usb_driver vp7045_usb_driver = { 287static struct usb_driver vp7045_usb_driver = {
306 .name = "dvb_usb_vp7045", 288 .name = "dvb_usb_vp7045",
307 .probe = vp7045_usb_probe, 289 .probe = vp7045_usb_probe,
308 .disconnect = vp7045_usb_disconnect, 290 .disconnect = dvb_usb_device_exit,
309 .id_table = vp7045_usb_table, 291 .id_table = vp7045_usb_table,
310}; 292};
311 293