Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4153381pxv; Mon, 19 Jul 2021 18:37:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8m1gZyw0GIvo+eY9HqftI1BqBqvPNiGiGxiWbsQMYulNXIkf+xnAbPR1P8/2U7ERtVtDR X-Received: by 2002:a17:906:844:: with SMTP id f4mr29085604ejd.78.1626745049949; Mon, 19 Jul 2021 18:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626745049; cv=none; d=google.com; s=arc-20160816; b=njga5jYWU6hr5hup5zmC28RKk//IpGbFPnBF6NIO8DHL8zQbovXWSEp59lgStv9eHz mXPz+V7uSqHcMwsKBLGn3qD676yJBAI/RkdDeJXRMnbH2mYjZySGdYtWf2l1IXKSl33+ XuN+dmWrxUEzjHF5ALF5md9uZYZjWvR8yDS5qLFfaBdJn6fV5ffTkEYuX1GbF55Zunts 38C908xC6njBxCrqHQiBUaILcyXxqgZcA+O6QRYe1pYqIxhjHuDSFofjLVTeY6x2kd6Q sKbxjoaEIZaiI1C88lhrwqYZPkp7ojLeTILva6ULN1HSYL2JYjGaesBT93MQIsVKkRti vVJg== 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=KqaHcocy757ynElaeKwb5qWcPEuwMLWZVhGpS5iaQUM=; b=t4G76ufIQaKh7EYbOiQHJwlth6yJ+qy4+51yb3T91B1gw/B08zT6Ta1N1DgFNxIZS5 5Q1a/+tbCFrG4oxsXk8jUCXTR2Yc8oT0F+MwxU9kB4kILuKF4sDzi/V5pEaI+y5hP3vd 6JEQlimoQ0T7XPzn80udDvlYgqKAtz6ZikHySXEqInFrLroM9pxhOgiqMlHCy1rCXQYT MhOreFpkSoJdh0b/oNV2HHsL9UL9QBLjwIFg8D1flLqKwe02AZv/xBnYDrxHT/Ch/pPp +VsGVrs3m7xxFt+kJDa4ooye3l8/MnCWViNvSYjzByDKRh/t93cM+QpRKgmeXSY+oovW c3DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BjnB6WB+; 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 s10si22542165edr.36.2021.07.19.18.37.07; Mon, 19 Jul 2021 18:37: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=BjnB6WB+; 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 S237816AbhGSOy4 (ORCPT + 99 others); Mon, 19 Jul 2021 10:54:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:46648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243859AbhGSOfP (ORCPT ); Mon, 19 Jul 2021 10:35:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8509860551; Mon, 19 Jul 2021 15:15:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626707755; bh=SIPfpxfa8ElFAK5ax8K3+1DMagt4u+7Okx+cyHPvZ3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BjnB6WB+FmYKhtefQ301mGiNLaVTz9ZMdxcwI3mhh4JbnsOTjYATNq2OJxEqNSqPM ML0AARYzmyXAy3sbYoaVpJm3DSRoUOprFC4fl6LVVdIxcXRzCP3NCCcblaV20RF4jc hVmbSgaJwgECaWM0AFCkJSVl5ikh35wjqx5Ph+lI= 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 4.14 044/315] media: pvrusb2: fix warning in pvr2_i2c_core_done Date: Mon, 19 Jul 2021 16:48:53 +0200 Message-Id: <20210719144944.316203601@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144942.861561397@linuxfoundation.org> References: <20210719144942.861561397@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 18db7aaafcd6..fd1bd94cd78f 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -2670,9 +2670,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) && @@ -2699,6 +2698,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