linux/drivers/char/ipmi
Zhang Yuchen 44847a506e ipmi: fix SSIF not responding under certain cond.
commit 6d2555cde2 upstream.

The ipmi communication is not restored after a specific version of BMC is
upgraded on our server.
The ipmi driver does not respond after printing the following log:

    ipmi_ssif: Invalid response getting flags: 1c 1

I found that after entering this branch, ssif_info->ssif_state always
holds SSIF_GETTING_FLAGS and never return to IDLE.

As a result, the driver cannot be loaded, because the driver status is
checked during the unload process and must be IDLE in shutdown_ssif():

        while (ssif_info->ssif_state != SSIF_IDLE)
                schedule_timeout(1);

The process trigger this problem is:

1. One msg timeout and next msg start send, and call
ssif_set_need_watch().

2. ssif_set_need_watch()->watch_timeout()->start_flag_fetch() change
ssif_state to SSIF_GETTING_FLAGS.

3. In msg_done_handler() ssif_state == SSIF_GETTING_FLAGS, if an error
message is received, the second branch does not modify the ssif_state.

4. All retry action need IS_SSIF_IDLE() == True. Include retry action in
watch_timeout(), msg_done_handler(). Sending msg does not work either.
SSIF_IDLE is also checked in start_next_msg().

5. The only thing that can be triggered in the SSIF driver is
watch_timeout(), after destory_user(), this timer will stop too.

So, if enter this branch, the ssif_state will remain SSIF_GETTING_FLAGS
and can't send msg, no timer started, can't unload.

We did a comparative test before and after adding this patch, and the
result is effective.

Fixes: 259307074b ("ipmi: Add SMBus interface driver (SSIF)")

Cc: stable@vger.kernel.org
Signed-off-by: Zhang Yuchen <zhangyuchen.lcr@bytedance.com>
Message-Id: <20230412074907.80046-1-zhangyuchen.lcr@bytedance.com>
Signed-off-by: Corey Minyard <minyard@acm.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-11 23:03:01 +09:00
..
bt-bmc.c ipmi: bt: Add ast2600 compatible string 2021-10-07 14:02:45 -05:00
ipmb_dev_int.c i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
ipmi_bt_sm.c
ipmi_devintf.c ipmi:devintf: Return a proper error when recv buffer too small 2021-10-05 06:54:16 -05:00
ipmi_dmi.c
ipmi_dmi.h
ipmi_ipmb.c ipmi: ipmb: Fix the MODULE_PARM_DESC associated to 'retry_time_ms' 2023-03-10 09:34:03 +01:00
ipmi_kcs_sm.c
ipmi_msghandler.c ipmi: fix use after free in _ipmi_destroy_user() 2023-01-07 11:11:52 +01:00
ipmi_plat_data.c
ipmi_plat_data.h
ipmi_powernv.c
ipmi_poweroff.c ipmi: Add an intializer for ipmi_recv_msg struct 2022-05-12 10:00:03 -05:00
ipmi_si_hardcode.c
ipmi_si_hotmod.c
ipmi_si_intf.c ipmi: fix long wait in unload when IPMI disconnect 2023-01-07 11:11:52 +01:00
ipmi_si_mem_io.c
ipmi_si_parisc.c parisc: Make struct parisc_driver::remove() return void 2021-08-30 10:18:25 +02:00
ipmi_si_pci.c
ipmi_si_platform.c parisc: Make struct parisc_driver::remove() return void 2021-08-30 10:18:25 +02:00
ipmi_si_port_io.c
ipmi_si_sm.h
ipmi_si.h parisc: Make struct parisc_driver::remove() return void 2021-08-30 10:18:25 +02:00
ipmi_smic_sm.c
ipmi_ssif.c ipmi: fix SSIF not responding under certain cond. 2023-05-11 23:03:01 +09:00
ipmi_watchdog.c ipmi: Add an intializer for ipmi_recv_msg struct 2022-05-12 10:00:03 -05:00
Kconfig char: ipmi: modify NPCM KCS configuration 2022-07-18 19:27:57 -05:00
kcs_bmc_aspeed.c ipmi: kcs: Poll OBF briefly to reduce OBE latency 2022-12-31 13:32:03 +01:00
kcs_bmc_cdev_ipmi.c ipmi: Add __init/__exit annotations to module init/exit funcs 2022-09-22 10:55:46 -05:00
kcs_bmc_client.h ipmi: kcs_bmc: Allow clients to control KCS IRQ state 2021-06-21 19:50:28 -05:00
kcs_bmc_device.h ipmi: kcs_bmc: Allow clients to control KCS IRQ state 2021-06-21 19:50:28 -05:00
kcs_bmc_npcm7xx.c ipmi: kcs_bmc: Enable IBF on open 2021-06-21 19:50:28 -05:00
kcs_bmc_serio.c ipmi: Add __init/__exit annotations to module init/exit funcs 2022-09-22 10:55:46 -05:00
kcs_bmc.c ipmi: kcs_bmc: Enable IBF on open 2021-06-21 19:50:28 -05:00
kcs_bmc.h ipmi: kcs_bmc: Allow clients to control KCS IRQ state 2021-06-21 19:50:28 -05:00
Makefile ipmi:ipmb: Add initial support for IPMI over IPMB 2021-10-05 06:54:17 -05:00