From: Felix Gu <ustc.gu@gmail.com>
To: Corey Minyard <corey@minyard.net>
Cc: openipmi-developer@lists.sourceforge.net,
linux-kernel@vger.kernel.org, Felix Gu <ustc.gu@gmail.com>
Subject: [PATCH] ipmi: Fix sysfs file leak on maintenance_mode creation failure
Date: Fri, 27 Mar 2026 21:40:30 +0800 [thread overview]
Message-ID: <20260327-ipmi-v1-1-d4a4417140b2@gmail.com> (raw)
When device_create_file() for maintenance_mode_devattr fails, the error
handler only removes nr_users_devattr but forgets to remove
nr_msgs_devattr, causing a sysfs file leak.
Fixes: 627118470fcc ("ipmi: Add a maintenance mode sysfs file")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/char/ipmi/ipmi_msghandler.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 869ac87a4b6a..f59db5df69da 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -3734,6 +3734,7 @@ int ipmi_add_smi(struct module *owner,
sysfs_attr_init(&intf->maintenance_mode_devattr.attr);
rv = device_create_file(intf->si_dev, &intf->maintenance_mode_devattr);
if (rv) {
+ device_remove_file(intf->si_dev, &intf->nr_msgs_devattr);
device_remove_file(intf->si_dev, &intf->nr_users_devattr);
goto out_err_bmc_reg;
}
---
base-commit: 66ba480978ce390e631e870b740a3406e3eb6b01
change-id: 20260327-ipmi-4851eac6305f
Best regards,
--
Felix Gu <ustc.gu@gmail.com>
next reply other threads:[~2026-03-27 13:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-27 13:40 Felix Gu [this message]
2026-03-28 18:40 ` Markus Elfring
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=20260327-ipmi-v1-1-d4a4417140b2@gmail.com \
--to=ustc.gu@gmail.com \
--cc=corey@minyard.net \
--cc=linux-kernel@vger.kernel.org \
--cc=openipmi-developer@lists.sourceforge.net \
/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®