Commit 30f6c9d5 authored by Corey Minyard's avatar Corey Minyard
Browse files

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: default avatarCorey Minyard <corey@minyard.net>
Tested-by: default avatarFrederick Lawler <fred@cloudflare.com>
parent e5feb030
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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 @@ static int __bmc_get_device_id(struct ipmi_smi *intf, struct bmc_device *bmc,
	    (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);