Skip to contentSkip to conversation

ACPI: ipmi: Remove address space handler in error path

PATCH Applied Hanjun Guo 2 participants 2 messages May 24, 2021 ACPI

lore
Share & tools
lore

Hanjun Guo

author
#0 lore raw

PATCH 1/1 ACPI: ipmi: Remove address space handler in error path

The acpi_install_address_space_handler() is coupled with acpi_remove_address_space_handler() in ipmi module init/exit, but failed to remove the handler in acpi_ipmi_init() if the ipmi_smi_watcher_register() failed, so adding the removal of the address space handler in error path.

---
 drivers/acpi/acpi_ipmi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/acpi/acpi_ipmi.c +6 -1
index bbd00d9..a5fe292 100644
@@ -597,9 +597,14 @@ static int __init acpi_ipmi_init(void)
 		pr_warn("Can't register IPMI opregion space handle\n");
 		return -EINVAL;
 	}
+
 	result = ipmi_smi_watcher_register(&driver_data.bmc_events);
-	if (result)
+	if (result) {
+		acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
+										  ACPI_ADR_SPACE_IPMI,
+										  &acpi_ipmi_space_handler);
 		pr_err("Can't register IPMI system interface watcher\n");
+	}
 
 	return result;
 }
Signature · 1 line
1.7.12.4
maintainer Applied
#1 lore raw
Quoted 22 lines · Hanjun Guo

The acpi_install_address_space_handler() is coupled with acpi_remove_address_space_handler() in ipmi module init/exit, but failed to remove the handler in acpi_ipmi_init() if the ipmi_smi_watcher_register() failed, so adding the removal of the address space handler in error path.

---
 drivers/acpi/acpi_ipmi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/acpi/acpi_ipmi.c +1 -1
index bbd00d9..a5fe292 100644
@@ -597,9 +597,14 @@ static int __init acpi_ipmi_init(void)
                pr_warn("Can't register IPMI opregion space handle\n");
                return -EINVAL;
        }
+
        result = ipmi_smi_watcher_register(&driver_data.bmc_events);
-       if (result)

drivers/acpi/acpi_ipmi.c static int __init acpi_ipmi_init(void)

Quoted 10 lines
drivers/acpi/acpi_ipmi.c +5 -1
+       if (result) {
+               acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
+                                                                                 ACPI_ADR_SPACE_IPMI,
+                                                                                 &acpi_ipmi_space_handler);
                pr_err("Can't register IPMI system interface watcher\n");
+       }
 
        return result;
 }
--

Applied as 5.14 material with some edits in the changelog, thanks!