On Thu Sep 17 10:09:24 2026 +0000, Wentao Liang wrote:
> 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: [email protected]
> Signed-off-by: Wentao Liang <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>

Patch committed.

Thanks,
Hans Verkuil

 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 dba43d4c24f2..678e069b4c92 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;
        }
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to