ipmi: Don't allow device module unload when in use
authorCorey Minyard <cminyard@mvista.com>
Mon, 14 Oct 2019 15:35:56 +0000 (10:35 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Dec 2019 15:35:23 +0000 (16:35 +0100)
commitf9d405a4bd6090ffbf3bba5e2da6b44c0e013cb3
tree081c53f21081dab7f591b8384ae82a0dc23ca7ae
parentd760750246d930700b7975642be907866d672e0a
ipmi: Don't allow device module unload when in use

[ Upstream commit cbb79863fc3175ed5ac506465948b02a893a8235 ]

If something has the IPMI driver open, don't allow the device
module to be unloaded.  Before it would unload and the user would
get errors on use.

This change is made on user request, and it makes it consistent
with the I2C driver, which has the same behavior.

It does change things a little bit with respect to kernel users.
If the ACPI or IPMI watchdog (or any other kernel user) has
created a user, then the device module cannot be unloaded.  Before
it could be unloaded,

This does not affect hot-plug.  If the device goes away (it's on
something removable that is removed or is hot-removed via sysfs)
then it still behaves as it did before.

Reported-by: tony camuso <tcamuso@redhat.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Tested-by: tony camuso <tcamuso@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/char/ipmi/ipmi_msghandler.c
include/linux/ipmi_smi.h