Re: [Openipmi-developer] Issue with panic handling and ipmi

From: Corey Minyard
Date: Mon Sep 20 2021 - 07:38:09 EST


Well, that was dumb. Fix follows...

Thanks for working on this. On your approval, I'll send this to Linus.

-corey

ipmi:watchdog: Set panic count to proper value on a panic

You will get two decrements when the messages on a panic are sent, not
one, since 2033f6858970 ("ipmi: Free receive messages when in an oops")
was added, but the watchdog code had a bug where it didn't set the value
properly.

Reported-by: Anton Lundin <glance@xxxxxxxxxx>
Cc: <Stable@xxxxxxxxxxxxxxx> # v5.4+
Fixes: 2033f6858970 ("ipmi: Free receive messages when in an oops")
Signed-off-by: Corey Minyard <cminyard@xxxxxxxxxx>
---
drivers/char/ipmi/ipmi_watchdog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index e4ff3b50de7f..9a64a069ffd1 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -531,7 +531,7 @@ static void panic_halt_ipmi_set_timeout(void)
/* Wait for the messages to be free. */
while (atomic_read(&panic_done_count) != 0)
ipmi_poll_interface(watchdog_user);
- atomic_inc(&panic_done_count);
+ atomic_set(&panic_done_count, 2);
rv = __ipmi_set_timeout(&panic_halt_smi_msg,
&panic_halt_recv_msg,
&send_heartbeat_now);