diff options
author | Corey Minyard <minyard@acm.org> | 2022-09-09 20:31:39 -0500 |
---|---|---|
committer | Corey Minyard <cminyard@mvista.com> | 2022-09-09 20:34:24 -0500 |
commit | 80d98a33008cbfd9ed0271b0e253ff88b51f96ac (patch) | |
tree | a51f3ea3fad4d277e85a9d4dd459fa1482c12501 /drivers/char/ipmi | |
parent | ba5829c6543fbcf0b31854cc6970b9012ff71279 (diff) | |
download | linux-80d98a33008cbfd9ed0271b0e253ff88b51f96ac.tar.gz linux-80d98a33008cbfd9ed0271b0e253ff88b51f96ac.tar.bz2 linux-80d98a33008cbfd9ed0271b0e253ff88b51f96ac.zip |
ipmi:ipmb: Don't call ipmi_unregister_smi() on a register failure
The data structure won't be set up to be unregistered, and it can result in
crashes if the register fails.
Signed-off-by: Corey Minyard <minyard@acm.org>
Diffstat (limited to 'drivers/char/ipmi')
-rw-r--r-- | drivers/char/ipmi/ipmi_ipmb.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/char/ipmi/ipmi_ipmb.c b/drivers/char/ipmi/ipmi_ipmb.c index 1019946abe4e..740dc0f824e0 100644 --- a/drivers/char/ipmi/ipmi_ipmb.c +++ b/drivers/char/ipmi/ipmi_ipmb.c @@ -424,10 +424,8 @@ static void ipmi_ipmb_request_events(void *send_info) /* We don't fetch events here. */ } -static int ipmi_ipmb_remove(struct i2c_client *client) +static void ipmi_ipmb_cleanup(struct ipmi_ipmb_dev *iidev) { - struct ipmi_ipmb_dev *iidev = i2c_get_clientdata(client); - if (iidev->slave) { i2c_slave_unregister(iidev->slave); if (iidev->slave != iidev->client) @@ -436,7 +434,13 @@ static int ipmi_ipmb_remove(struct i2c_client *client) iidev->slave = NULL; iidev->client = NULL; ipmi_ipmb_stop_thread(iidev); +} + +static int ipmi_ipmb_remove(struct i2c_client *client) +{ + struct ipmi_ipmb_dev *iidev = i2c_get_clientdata(client); + ipmi_ipmb_cleanup(iidev); ipmi_unregister_smi(iidev->intf); return 0; @@ -544,7 +548,7 @@ static int ipmi_ipmb_probe(struct i2c_client *client) out_err: if (slave && slave != client) i2c_unregister_device(slave); - ipmi_ipmb_remove(client); + ipmi_ipmb_cleanup(iidev); return rv; } |