Commit 0a867356 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] dvb_usb_v2: ensure driver_info is not null

It could be null in case of driver does not set it
properly, like missing dynamic ID handling.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e48b2a68
...@@ -258,10 +258,18 @@ int dvb_usbv2_device_init_(struct usb_interface *intf, ...@@ -258,10 +258,18 @@ int dvb_usbv2_device_init_(struct usb_interface *intf,
struct dvb_usb_device *d = NULL; struct dvb_usb_device *d = NULL;
struct dvb_usb_driver_info *driver_info = struct dvb_usb_driver_info *driver_info =
(struct dvb_usb_driver_info *) id->driver_info; (struct dvb_usb_driver_info *) id->driver_info;
const struct dvb_usb_device_properties *props = driver_info->props; const struct dvb_usb_device_properties *props;
int ret = -ENOMEM; int ret = -ENOMEM;
bool cold = false; bool cold = false;
if (!id->driver_info) {
pr_err("%s: driver_info is null", KBUILD_MODNAME);
ret = -ENODEV;
goto err;
}
props = driver_info->props;
d = kzalloc(sizeof(struct dvb_usb_device), GFP_KERNEL); d = kzalloc(sizeof(struct dvb_usb_device), GFP_KERNEL);
if (d == NULL) { if (d == NULL) {
err("no memory for 'struct dvb_usb_device'"); err("no memory for 'struct dvb_usb_device'");
...@@ -326,7 +334,8 @@ int dvb_usbv2_device_init_(struct usb_interface *intf, ...@@ -326,7 +334,8 @@ int dvb_usbv2_device_init_(struct usb_interface *intf,
err_kfree: err_kfree:
kfree(d->priv); kfree(d->priv);
kfree(d); kfree(d);
err:
pr_debug("%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment