Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3348041pxv; Sun, 4 Jul 2021 16:14:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/OVoN+mFPJqt+Z70jZPSngMLrj0XvwhSQop3P5O0XQq25z4RTdqoCg6axeBmOT1C/17Qs X-Received: by 2002:a5d:8b85:: with SMTP id p5mr9209806iol.43.1625440468371; Sun, 04 Jul 2021 16:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625440468; cv=none; d=google.com; s=arc-20160816; b=ZeS1baEFysirluuc1n40XMkhpKXbqn5aHqXs7fg5Hk3lh5RxYGtDf8tDhEIUMOeswi g/mW9Xk9FnS1GyocbhTGrCTcIR95R9nCfBgxBhZ+8egc2pVTjnWqnrcX7XNlIkx1BjLI IFuPLg2UGxRU52Bn8feMRLu9lU0kHQ28wddnoYk6Od0uVNJoVE1vt8f6a3uOf0VValQh DbXVGKbQSEnnsd8Wi2xLddOzYIwKfWf5E+GlVydT5dqp2yALslIi/KE7CF0zp7fOiG5l NWARqx7vT2STpcNQbz73CuQRKt37mHrLKqzjxZMhb2dbMsMNTgFrMfqF5pSrSwacKn27 zZzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rdU4SUq1ZFQWhmudnNusPudzPZ9Xfi9XV1pvPoXjwAA=; b=jcX7cXuMwsAMfd6GKNQkqWelVbXzKb1UeXtw/K09zhNqnMPTMWNkJqxT9C/Mw37EpE eV0KyXeD5ZmPYiSHaedGcJEfY3sezuAlTr1eKBlAU+KiJcc3VDTFgKcQv0hypr3FqJHy /Bg06e6wTE1dpVLNWYsUIC9vRNxHHqKQ8xc9HHQ94PfZhTj44omYt1OpvI9jvewOW6s7 ePOA04/dkRk1WL36wBA5/nJAM4qcXvcwg6o+3fZ1jA+CsVhlezNSefUDAvlK1XdejbIz E+F8+/wpiHc4ut5Uc7UFaDovmTFMTQRdcrxct0mX5JRxTYPZ7zRi7wVboN6DZrmIQF3h 9IaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C+XnL1rh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n1si12874015jat.109.2021.07.04.16.14.16; Sun, 04 Jul 2021 16:14:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C+XnL1rh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233343AbhGDXOW (ORCPT + 99 others); Sun, 4 Jul 2021 19:14:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:47420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231933AbhGDXJg (ORCPT ); Sun, 4 Jul 2021 19:09:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E1B0161936; Sun, 4 Jul 2021 23:06:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625440016; bh=UP4NVnaV6TahKYzkSvQfpMg9+VdQvMocKGAKxZKRlTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C+XnL1rheRnFbLkI99Pq85BaMU1UsdID+B+eWHhh/RWOpVmS/9pwFy3ispyn2cCrW aNtN1ykiOLxDc4a3ZSmNTxQRWWcK15WHmTho2iwFe0YOwF8+2dxkj2IrjXz05j7SbN c5GlruYMJMJDA+MYU/MaH/5ecFFghYCN6ZEca13fBrgWqefKQOIUN9ZoOCib8KnFfr RHno4xlho8pw9/wX6uUX+f2BQ4VflYGO6xg6u4gQWHxUzACUhUrvjEKjsfbidBv4O9 oNm9AY5xJj1u2L5kveXF+DSLXSdL+aK3egGCbJdouHfTBaZhJ4pFS7NVs4nhSRVs2f kXiK0QkW3GYWQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Anirudh Rayabharam , syzbot+e74a998ca8f1df9cc332@syzkaller.appspotmail.com, Greg Kroah-Hartman , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 5.12 29/80] media: pvrusb2: fix warning in pvr2_i2c_core_done Date: Sun, 4 Jul 2021 19:05:25 -0400 Message-Id: <20210704230616.1489200-29-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210704230616.1489200-1-sashal@kernel.org> References: <20210704230616.1489200-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anirudh Rayabharam [ 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 Signed-off-by: Anirudh Rayabharam Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- 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 f4a727918e35..d38dee1792e4 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -2676,9 +2676,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) && @@ -2705,6 +2704,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