Linux driver-core infrastructure
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: <driver-core@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Rajat Jain" <rajatja@google.com>, "stable" <stable@kernel.org>
Subject: Re: [PATCH] sysfs: don't remove existing directory on update failure
Date: Wed, 20 May 2026 16:45:30 +0200	[thread overview]
Message-ID: <DINL2MQVAJUK.38K7BGL323D5U@kernel.org> (raw)
In-Reply-To: <2026052003-uniquely-hastily-c093@gregkh>

On Wed May 20, 2026 at 3:05 PM CEST, Greg Kroah-Hartman wrote:
> When sysfs_update_group() is called for a named group and create_files()
> fails (e.g. -ENOMEM), internal_create_group() calls kernfs_remove(kn) on
> the group directory.  In the update path, kn was obtained via
> kernfs_find_and_get() and refers to a directory that already existed
> before this call.  Removing it silently destroys a sysfs group that the
> caller did not create.
>
> Only remove the directory if we created it ourselves.  On update failure
> the directory remains as it is left empty by remove_files() inside
> create_files(), but can be repopulated by a retry.
>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: Danilo Krummrich <dakr@kernel.org>
> Cc: Rajat Jain <rajatja@google.com>
> Fixes: c855cf2759d2 ("sysfs: Fix internal_create_group() for named group updates")
> Cc: stable <stable@kernel.org>
> Assisted-by: gkh_clanker_t1000
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Danilo Krummrich <dakr@kernel.org>

  parent reply	other threads:[~2026-05-20 14:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20 13:05 [PATCH] sysfs: don't remove existing directory on update failure Greg Kroah-Hartman
2026-05-20 13:34 ` Rafael J. Wysocki
2026-05-20 14:45 ` Danilo Krummrich [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-05-20 13:06 Greg Kroah-Hartman
2026-05-20 13:12 ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DINL2MQVAJUK.38K7BGL323D5U@kernel.org \
    --to=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rajatja@google.com \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox