From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: rafael@kernel.org, dakr@kernel.org, johan@kernel.org
Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org,
Josef Bacik <josef@toxicpanda.com>, stable <stable@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH] driver core: Limit the messages on a refused uevent
Date: Tue, 27 Oct 2026 18:18:19 +0100 [thread overview]
Message-ID: <2026102718-conduit-glorious-a8dc@gregkh> (raw)
From: Josef Bacik <josef@toxicpanda.com>
A write to a "uevent" file which is no valid action makes
kobject_synth_uevent() print a warning and uevent_store() an error every
time. This is generally considered a bad thing so rate limit these
messages.
Fixes: b0e37c0d8a6a ("net-sysfs: make sure objects belong to container's owner")
Cc: stable <stable@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/base/core.c | 4 +++-
lib/kobject_uevent.c | 6 +++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index f21e225abd51..0e2eccd3e613 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2881,7 +2881,9 @@ static ssize_t uevent_store(struct device *dev, const struct device_attribute *a
rc = kobject_synth_uevent(&dev->kobj, buf, count);
if (rc) {
- dev_err(dev, "uevent: failed to send synthetic uevent: %d\n", rc);
+ dev_err_ratelimited(dev,
+ "uevent: failed to send synthetic uevent: %d\n",
+ rc);
return rc;
}
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 1480e2c27ed0..1d29378d4f55 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -223,9 +223,9 @@ int kobject_synth_uevent(struct kobject *kobj, const char *buf, size_t count)
out:
if (r) {
devpath = kobject_get_path(kobj, GFP_KERNEL);
- pr_warn("synth uevent: %s: %s\n",
- devpath ?: "unknown device",
- msg ?: "failed to send uevent");
+ pr_warn_ratelimited("synth uevent: %s: %s\n",
+ devpath ?: "unknown device",
+ msg ?: "failed to send uevent");
kfree(devpath);
}
return r;
--
2.56.0
reply other threads:[~2026-10-27 17:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=2026102718-conduit-glorious-a8dc@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=johan@kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--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
all inboxes | Powered by JetHome®