7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wentao Liang [ Upstream commit 02421d7278e4a62c3daf37ad6c45d4af96ee4252 ] class_dev_create() stores a reference to the USB device obtained with get_device() in class_dev->parent, which class_dev_destroy() releases. When device_register() fails the function only drops class_dev, so the reference to the USB parent device is never released. Drop the parent reference on the failure path as well. Fixes: 28c4a5e6d324 ("V4L/DVB: pvrusb2: Fix USB parent device reference count") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/usb/pvrusb2/pvrusb2-sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c b/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c index dba43d4c24f23..678e069b4c924 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c @@ -633,6 +633,7 @@ static void class_dev_create(struct pvr2_sysfs *sfp) if (ret) { pvr2_trace(PVR2_TRACE_ERROR_LEGS, "device_register failed"); + put_device(class_dev->parent); put_device(class_dev); return; } -- 2.53.0