linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Anirudh Rayabharam <mail@anirudhrb.com>,
	syzbot+e74a998ca8f1df9cc332@syzkaller.appspotmail.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Sasha Levin <sashal@kernel.org>,
	linux-media@vger.kernel.org
Subject: [PATCH AUTOSEL 4.9 07/20] media: pvrusb2: fix warning in pvr2_i2c_core_done
Date: Sun,  4 Jul 2021 19:11:42 -0400	[thread overview]
Message-ID: <20210704231155.1491795-7-sashal@kernel.org> (raw)
In-Reply-To: <20210704231155.1491795-1-sashal@kernel.org>

From: Anirudh Rayabharam <mail@anirudhrb.com>

[ 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>
---
 drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
index ff489645e070..0cb8dd585235 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
@@ -2722,9 +2722,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) &&
@@ -2751,6 +2750,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);
-- 
2.30.2


  parent reply	other threads:[~2021-07-04 23:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-04 23:11 [PATCH AUTOSEL 4.9 01/20] spi: spi-loopback-test: Fix 'tx_buf' might be 'rx_buf' Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 02/20] spi: spi-topcliff-pch: Fix potential double free in pch_spi_process_messages() Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 03/20] spi: omap-100k: Fix the length judgment problem Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 04/20] crypto: nx - add missing MODULE_DEVICE_TABLE Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 05/20] media: cpia2: fix memory leak in cpia2_usb_probe Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 06/20] media: cobalt: fix race condition in setting HPD Sasha Levin
2021-07-04 23:11 ` Sasha Levin [this message]
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 08/20] crypto: qat - check return code of qat_hal_rd_rel_reg() Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 09/20] crypto: qat - remove unused macro in FW loader Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 10/20] media: v4l2-core: Avoid the dangling pointer in v4l2_fh_release Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 11/20] media: bt8xx: Fix a missing check bug in bt878_probe Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 12/20] media: st-hva: Fix potential NULL pointer dereferences Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 13/20] mmc: via-sdmmc: add a check against NULL pointer dereference Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 14/20] crypto: shash - avoid comparing pointers to exported functions under CFI Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 15/20] media: dvb_net: avoid speculation from net slot Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 16/20] media: siano: fix device register error path Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 17/20] btrfs: abort transaction if we fail to update the delayed inode Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 18/20] btrfs: make Private2 lifespan more consistent Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 19/20] btrfs: disable build on platforms having page size 256K Sasha Levin
2021-07-04 23:11 ` [PATCH AUTOSEL 4.9 20/20] regulator: da9052: Ensure enough delay time for .set_voltage_time_sel Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210704231155.1491795-7-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mail@anirudhrb.com \
    --cc=mchehab+huawei@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+e74a998ca8f1df9cc332@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).