Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2824614pxv; Mon, 12 Jul 2021 02:51:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE+k3ga95mOMoJQ8kBEY3h6OlSa0Rb/672ZhIgjNWA7+SgdcmgR9HRA15gX7aCi1+IniiB X-Received: by 2002:a5e:dd42:: with SMTP id u2mr28273006iop.135.1626083489543; Mon, 12 Jul 2021 02:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626083489; cv=none; d=google.com; s=arc-20160816; b=oWdb8roppuezcV1Z9Yv5NEg27EDtt/UZPiuwE+ouHN1BvgctBo8HEH2zI0AlFgGckW VMD5FdUlZo7Oc5EKmYJ1s2pRu0MAhhTkTy1yaa4S0LkxNOSUzpmlrWpdZ86Ld+jkei2q xbj0JuS2dSyj9cnmyP2yxD1h/dd1kEK/sLpMg5CLWPO0ozlNiAi1WjwkdNLesItV8Rbc a/sE9qGT0LbaR3vTl7KRbzKTZxdk5sDTaGCvV+ltzyPa5eisTGOJ+XlxE4jGNG5UDzQr Cg+eC+2HS3pcUhlVOLuPLAzuFECNx7O1xcw63v6f8Es1DMLUMS/EbV8PTksrx7k0IhJC zaOA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rdU4SUq1ZFQWhmudnNusPudzPZ9Xfi9XV1pvPoXjwAA=; b=AUNZGOxvXuZy0bYWMsaOMSn+cjEGsbPKn5fEmiyaNRlM3CJmVQD1WvaHWQqWwgCWwH R2bwyGav4fNETDacizRF09ZNmjRKJL5fL7ArktuyW35WGE4a7uR3NO1kVj6ANzMQbgTm GS7m6meDlMuZHgimG+NAe+6+yzaUo3R0hObaADoZlaAAaC6uivTy2tcxLqGAK+xSb2Xs y1sgg02U6xavy0je5DYZQsVHbKrzrFuoEtQvPNeww4Uqh/LlLOetzC+ZORKElpFSGReo K4tcX2VaPzRlD4fW92KtoeOepxECuI2FP58/8mRJGi8m+wCMcZmBP4SKgUmIKTyi3kUx utzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XyXh2IJ1; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w16si17287019jal.57.2021.07.12.02.51.18; Mon, 12 Jul 2021 02:51:29 -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=@linuxfoundation.org header.s=korg header.b=XyXh2IJ1; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236148AbhGLGq2 (ORCPT + 99 others); Mon, 12 Jul 2021 02:46:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:55500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236953AbhGLGfj (ORCPT ); Mon, 12 Jul 2021 02:35:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CA31761004; Mon, 12 Jul 2021 06:32:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071564; bh=UP4NVnaV6TahKYzkSvQfpMg9+VdQvMocKGAKxZKRlTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XyXh2IJ12A5J3XQdDR8vsjkcL66JFHRZAos20xmKbH4uRPRYsMpnZd5BhBYKIS0TP hrg7RwxH9icK5io3tYTZz7jV6Z6KQuKmzPU43AjuUklWeeHqZlwWzkWy6l4XdwAhnu 6tb5YudaQjTjrg5QWEe0VgGkmvAvzFPgiBQdryro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+e74a998ca8f1df9cc332@syzkaller.appspotmail.com, Anirudh Rayabharam , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 125/593] media: pvrusb2: fix warning in pvr2_i2c_core_done Date: Mon, 12 Jul 2021 08:04:45 +0200 Message-Id: <20210712060856.917148024@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060843.180606720@linuxfoundation.org> References: <20210712060843.180606720@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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