]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
media: pvrusb2: fix warning in pvr2_i2c_core_done
authorAnirudh Rayabharam <mail@anirudhrb.com>
Tue, 4 May 2021 17:08:58 +0000 (19:08 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 13 Aug 2021 07:45:04 +0000 (09:45 +0200)
BugLink: https://bugs.launchpad.net/bugs/1938199
[ Upstream commit f8194e5e63fdcb349e8da9eef9e574d5b1d687cb ]

syzbot has reported the following warning in pvr2_i2c_done:

sysfs group 'power' not found for kobject '1-0043'

When the device is disconnected (pvr_hdw_disconnect), the i2c adapter is
not unregistered along with the USB and v4l2 teardown. As part of the USB
device disconnect, the sysfs files of the subdevices are also deleted.
So, by the time pvr_i2c_core_done is called by pvr_context_destroy, the
sysfs files have been deleted.

To fix this, unregister the i2c adapter too in pvr_hdw_disconnect. Make
the device deregistration code shared by calling pvr_hdw_disconnect from
pvr2_hdw_destroy.

Reported-by: syzbot+e74a998ca8f1df9cc332@syzkaller.appspotmail.com
Tested-by: syzbot+e74a998ca8f1df9cc332@syzkaller.appspotmail.com
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/media/usb/pvrusb2/pvrusb2-hdw.c

index 1cfb7cf64131aa652f09f79b31a05b591aa3a9ad..4c991eae53cdf1ebf284bae1a029be822927513f 100644 (file)
@@ -2677,9 +2677,8 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw)
                pvr2_stream_destroy(hdw->vid_stream);
                hdw->vid_stream = NULL;
        }
-       pvr2_i2c_core_done(hdw);
        v4l2_device_unregister(&hdw->v4l2_dev);
-       pvr2_hdw_remove_usb_stuff(hdw);
+       pvr2_hdw_disconnect(hdw);
        mutex_lock(&pvr2_unit_mtx);
        do {
                if ((hdw->unit_number >= 0) &&
@@ -2706,6 +2705,7 @@ void pvr2_hdw_disconnect(struct pvr2_hdw *hdw)
 {
        pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_disconnect(hdw=%p)",hdw);
        LOCK_TAKE(hdw->big_lock);
+       pvr2_i2c_core_done(hdw);
        LOCK_TAKE(hdw->ctl_lock);
        pvr2_hdw_remove_usb_stuff(hdw);
        LOCK_GIVE(hdw->ctl_lock);