summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Minyard <corey@minyard.net>2025-08-07 16:05:24 -0500
committerCorey Minyard <corey@minyard.net>2025-09-08 10:21:41 -0500
commit30f6c9d5451de72ebc52aed6c15031696c6c5bd3 (patch)
treefa88871f19e105b541e91d5f633fa62db574fcec
parente5feb030d919f296257d628bae57d0494151dc24 (diff)
ipmi: Disable sysfs access and requests in maintenance mode
If the driver goes into any maintenance mode, disable sysfs access until it is done. If the driver goes into reset maintenance mode, disable all messages until it is done. Signed-off-by: Corey Minyard <corey@minyard.net> Tested-by: Frederick Lawler <fred@cloudflare.com>
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 18266ba11bc1..73d34085deae 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -2319,6 +2319,11 @@ static int i_ipmi_request(struct ipmi_user *user,
if (!run_to_completion)
mutex_lock(&intf->users_mutex);
+ if (intf->maintenance_mode_state == IPMI_MAINTENANCE_MODE_STATE_RESET) {
+ /* No messages while the BMC is in reset. */
+ rv = -EBUSY;
+ goto out_err;
+ }
if (intf->in_shutdown) {
rv = -ENODEV;
goto out_err;
@@ -2615,6 +2620,12 @@ retry_bmc_lock:
(bmc->dyn_id_set && time_is_after_jiffies(bmc->dyn_id_expiry)))
goto out_noprocessing;
+ /* Don't allow sysfs access when in maintenance mode. */
+ if (intf->maintenance_mode_state) {
+ rv = -EBUSY;
+ goto out_noprocessing;
+ }
+
prev_guid_set = bmc->dyn_guid_set;
__get_guid(intf);