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>
This commit is contained in:
parent
7aac98494d
commit
6e2980cc68
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user