[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190605130820.19306-1-wangkefeng.wang@huawei.com>
Date: Wed, 5 Jun 2019 21:08:20 +0800
From: Kefeng Wang <wangkefeng.wang@...wei.com>
To: Mike Isely <isely@...ox.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
<linux-media@...r.kernel.org>
CC: <linux-kernel@...r.kernel.org>,
Kefeng Wang <wangkefeng.wang@...wei.com>,
Hulk Robot <hulkci@...wei.com>
Subject: [PATCH] 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@...wei.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@...wei.com>
---
drivers/media/usb/pvrusb2/pvrusb2-sysfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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);
}
--
2.20.1
Powered by blists - more mailing lists