Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3343931pxv; Sun, 4 Jul 2021 16:06:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiXsukH3Kzmvndo32O+vES8wE9cambNDYhzKs+QPXYrk/kBF9BvGUK9Q7wCF4Tza9gF5ZL X-Received: by 2002:a05:6638:21b:: with SMTP id e27mr9797444jaq.80.1625439983926; Sun, 04 Jul 2021 16:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625439983; cv=none; d=google.com; s=arc-20160816; b=NAe1nqeLNjnsAj77eN1l3fxuVHfZbGwql0K68i0LxMcpo5lV13jC987o5t0Mct75qC IUmSd11XPPBR8iqN+Cuvtyw8acPxr9aubIIyrt+BfIGjwicnVWAAtN6HZawL2B128tBw WHR9uO6689fupNgHEQmmEuHTeGLhezXuuelOEghL5N5sA7Csg02jOlp4Tcs04KpPxxlj 8H9XYRoEV6XjTbsJLB86pebRNau0JKO20OFpUas7cvNsoszJvFQzsP51qMngc8zZxjYa 97POxL/JPijdhLwH6azMDP2QxWDHXwr2W9VHMO3Qm/zcSRrfXO9UcA7CSxbKB4nY5koM /gkA== 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=kKtwu5UumbhK8FQqPLqGVXJeD6RZphmFbHjXJIAfPoRGI6ZuUU0zdWayd14TyEPTG3 defWHwPgzL5RlmU5k6ETS1JMKPFFWHSRAk4AKtHw1NuLpa2zSULlTplu+0oaXj1WetRq 8WsFE4QCBlY/zxO7wtYaz4tyX+2rvkaIQQSaZZIHv65rm4ynwItqS9lpg3HURv/UsF+n LYkz6hDCnQYxMXu5Q4yf1cAGNXcHBRnWLnhA9tVczkVYRSsKqc5W1CCy5mbZr+frbpT+ JyCGxD+cPD3WIGBURuSb9/YZVnrCRqkizB0AlsEcLW6fombD+rL6FylV0urbP5oXiRKt Y7Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AIwj0S+P; 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 u15si1708863ilv.79.2021.07.04.16.06.12; Sun, 04 Jul 2021 16:06:23 -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=AIwj0S+P; 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 S230482AbhGDXH7 (ORCPT + 99 others); Sun, 4 Jul 2021 19:07:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:46010 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230257AbhGDXHh (ORCPT ); Sun, 4 Jul 2021 19:07:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7DCD6613FC; Sun, 4 Jul 2021 23:05:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625439901; bh=UP4NVnaV6TahKYzkSvQfpMg9+VdQvMocKGAKxZKRlTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AIwj0S+Pnfy9gm7Qv9rhXZFryxqySJlwpjUuqnf8OZC8atp/1yOdFJJmrvlkAVsr6 qod8pinV18ncT/Nj0RaGE0me9oqsbsOPVcrLhiA6S765ZsOxkPvTd77rbqs8PVPI65 xSd+NBqVujI7LZ9KS3alwxxSAvdGnnFjQCEY0JGqOk4OUh4XCk0J9CCxlCEzAnVB5E k5y9x0+U8YIyj9G0gNQL8scDOzAtcc4ZQYt9NndEkDsDnVV7Tk45ye3m1U7Bh9bMnw A1kEbcr3gs4E0xO4XZOzP9R00RiiHIMo1bDu4AreWB0VB8V1oW0LzpxGUmOnCjEgeQ JmJJqnQqwqE5Q== 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.13 29/85] media: pvrusb2: fix warning in pvr2_i2c_core_done Date: Sun, 4 Jul 2021 19:03:24 -0400 Message-Id: <20210704230420.1488358-29-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210704230420.1488358-1-sashal@kernel.org> References: <20210704230420.1488358-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