Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp680601rdf; Fri, 3 Nov 2023 11:37:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHmFkmH1z1BDKh0oXlkAvcS3QlrxsG4P0D2Wkfad4S/vy5b/oMwjwTnpBlIkGtOPQJlt5jp X-Received: by 2002:a17:90a:fa10:b0:27d:20ca:1156 with SMTP id cm16-20020a17090afa1000b0027d20ca1156mr18497942pjb.34.1699036620565; Fri, 03 Nov 2023 11:37:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699036620; cv=none; d=google.com; s=arc-20160816; b=Q9I7eAojtuAx4ZLwxi+8/K12exkkPc7/VceT2Ru7qbP8OFSp0ispTvcVDrKkm5fLXF KkZ9fxIz5g9VcQvNR7CZecVPJFkOxfsoeEDkh/AhtUujMUwIt9bM3e+gQCCDozcvWs0y CYNiVm1/zCOXdS4npWDVDAg0KWTqKZgMG3ldz+w+HxngkJmK6Rs+muBa33I653Puyxcv K01Ww42Cn4wPDx0OPsH8tqOdecVhppXsUSGt1pr4h98WehqCawZ8Dnde7oJeyYtV9U5B Em6ia81B4lXDV5VDTA/uagDPTdwTf9g7XAnpuairxv5l9HFhHD+vtYlPQ1z2rbTtiHxy tgKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=b+cFqCnQFLT2JNtWClFoEFe9Vt/yfFFahYWu5jrv7lY=; fh=mt3UrQ8Vias3/cKsGfvrSm49nu6QuBxu3+fpKGYrsLU=; b=ie+ZhUCGmnM1PjxwJb3I2maSxgmaI3M1b4JNHVYWLeYzaSLYwLp1hS7mSibE2S5/ZW tMMDF07/nLBhyOLgawJIJeq57rvHCZCDAM9z+iahBTD8YFRLo8u9DFCWpp6A+5Lpab+m lRAWVkgzsMzb9puSiZ9xfXNbsGwtWnvaFHN1FV1G728Jrb7uSlxyIqRsSK6EUvXobWFU E4WuS8S8pYq1nL0yZCO21ZwY3xfzsgXwdUQXgIPC2jeOdF1KESHqSHx5VNY3QpRs9gxT M7MRo/BeaJIDIj1tSkAKaJJVAlhAy2lAzgbgB3ClpT9Ldc2MXOF8sz9iFgemXEm0WP/F M2yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="VU/FOCJ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id u9-20020a17090adb4900b00280294ec225si2186056pjx.24.2023.11.03.11.36.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 11:37:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="VU/FOCJ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C070083DBEF3; Fri, 3 Nov 2023 11:36:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344848AbjKCSgg (ORCPT + 99 others); Fri, 3 Nov 2023 14:36:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233951AbjKCSgf (ORCPT ); Fri, 3 Nov 2023 14:36:35 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD2E9D47; Fri, 3 Nov 2023 11:36:29 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2D3DC433C9; Fri, 3 Nov 2023 18:36:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1699036589; bh=t9OfWxjmRBsqiXsPbyw2EcQvdxCl+LfcMDqz160D6P0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VU/FOCJ/cTCilDbfiLeOP72tgqUIXdMSVGR+Ke5guOy/o/T/rbXj1FufplOpovd+w Itxd0lOZTAw1wvsRc9+8rylrt0HhsOmJY6QfDgh+OjdSGr6t4EBqGkhhDCqM8tmeme mDRNr1NzPYZtZ4Sg7B5sdiVLT0UnDsz90WxQ6vXs= Date: Fri, 3 Nov 2023 19:36:21 +0100 From: Greg KH To: =?iso-8859-1?Q?Jos=E9?= Pekkarinen Cc: rafael@kernel.org, len.brown@intel.com, pavel@ucw.cz, skhan@linuxfoundation.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, syzbot+95f2e2439b97575ec3c0@syzkaller.appspotmail.com Subject: Re: [PATCH] drivers core: lookup sysfs power group before removal Message-ID: <2023110353-bring-contented-c9f8@gregkh> References: <20231101173627.2658-1-jose.pekkarinen@foxhound.fi> <2023110139-dupe-snipping-5700@gregkh> <835b2930c710381b8da38eca821aa92d@foxhound.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <835b2930c710381b8da38eca821aa92d@foxhound.fi> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 03 Nov 2023 11:36:45 -0700 (PDT) On Fri, Nov 03, 2023 at 07:49:39PM +0200, Jos? Pekkarinen wrote: > On 2023-11-01 19:54, Greg KH wrote: > > On Wed, Nov 01, 2023 at 07:36:27PM +0200, Jos? Pekkarinen wrote: > > > Hinted by syzboot, there is a few cases where the sysfs power group > > > may > > > not be there, like the failure while adding it, or adding its runtime > > > group, or when the sysfs firmware loader fallback fail to populate. In > > > the last case, the device_del function will be called leading to > > > attempt > > > to remove the sysfs group. This patch will lookup for it in advance to > > > grant that it is effectively there before cleaning it up. > > > > > > Reported-by: syzbot+95f2e2439b97575ec3c0@syzkaller.appspotmail.com > > > > > > Signed-off-by: Jos? Pekkarinen > > > --- > > > drivers/base/power/sysfs.c | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c > > > index a1474fb67db9..6601729c4698 100644 > > > --- a/drivers/base/power/sysfs.c > > > +++ b/drivers/base/power/sysfs.c > > > @@ -834,5 +834,7 @@ void dpm_sysfs_remove(struct device *dev) > > > dev_pm_qos_constraints_destroy(dev); > > > rpm_sysfs_remove(dev); > > > sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group); > > > - sysfs_remove_group(&dev->kobj, &pm_attr_group); > > > + > > > + if (kernfs_find_and_get((&dev->kobj)->sd, pm_attr_group.name)) > > > + sysfs_remove_group(&dev->kobj, &pm_attr_group); > > > > What's to keep it from going away right after finding it? > > > > In other words, what is wrong with removing a group that is not there? > > What error happens? It should be fine, or are you seeing real code > > failures somewhere? > > No, this is just hitting a warning that sysbot complains about by > setting panic on warning, no big deal, though it can be a wrong behaviour > in ueagle-atm driver, since it defines to disconnect the device if the > firmware is not there, no matter the sysfs fallback. Then fix the driver please. And what warning are you seeing exactly? thanks, greg k-h