summaryrefslogtreecommitdiff
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorKefeng Wang <wangkefeng.wang@huawei.com>2019-06-05 09:08:20 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-06-05 15:57:46 -0400
commit6e2980cc68d0dfac1c734fae887754c1cb9904a0 (patch)
tree2ba41dfd5ac327fb0c9aee6398b2db5cb3c988eb /drivers/media/usb
parent7aac98494d1d932cde053861ce0c12ca5ab3f762 (diff)
media: pvrusb2: fix null-ptr-deref in class_unregister()
The class_ptr will be NULL if pvr2_sysfs_class_create() fails in pvr_init(), when call pvr2_sysfs_class_destroy(), it will lead to null-ptr-deref, fix it. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/pvrusb2/pvrusb2-sysfs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c b/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c
index 7bc6d090358e..b6c6b314fadc 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c
@@ -802,7 +802,8 @@ struct pvr2_sysfs_class *pvr2_sysfs_class_create(void)
void pvr2_sysfs_class_destroy(struct pvr2_sysfs_class *clp)
{
pvr2_sysfs_trace("Unregistering pvr2_sysfs_class id=%p", clp);
- class_unregister(&clp->class);
+ if (clp)
+ class_unregister(&clp->class);
}