Skip to content

Commit 30f6c9d

Browse files
committed
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>
1 parent e5feb03 commit 30f6c9d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

drivers/char/ipmi/ipmi_msghandler.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,6 +2319,11 @@ static int i_ipmi_request(struct ipmi_user *user,
23192319

23202320
if (!run_to_completion)
23212321
mutex_lock(&intf->users_mutex);
2322+
if (intf->maintenance_mode_state == IPMI_MAINTENANCE_MODE_STATE_RESET) {
2323+
/* No messages while the BMC is in reset. */
2324+
rv = -EBUSY;
2325+
goto out_err;
2326+
}
23222327
if (intf->in_shutdown) {
23232328
rv = -ENODEV;
23242329
goto out_err;
@@ -2615,6 +2620,12 @@ static int __bmc_get_device_id(struct ipmi_smi *intf, struct bmc_device *bmc,
26152620
(bmc->dyn_id_set && time_is_after_jiffies(bmc->dyn_id_expiry)))
26162621
goto out_noprocessing;
26172622

2623+
/* Don't allow sysfs access when in maintenance mode. */
2624+
if (intf->maintenance_mode_state) {
2625+
rv = -EBUSY;
2626+
goto out_noprocessing;
2627+
}
2628+
26182629
prev_guid_set = bmc->dyn_guid_set;
26192630
__get_guid(intf);
26202631

0 commit comments

Comments
 (0)