Skip to content

Commit db05ddf

Browse files
committed
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 commit 2033f68 ("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 <[email protected]> Cc: <[email protected]> # v5.4+ Fixes: 2033f68 ("ipmi: Free receive messages when in an oops") Signed-off-by: Corey Minyard <[email protected]>
1 parent 6880fa6 commit db05ddf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/char/ipmi/ipmi_watchdog.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ static void panic_halt_ipmi_heartbeat(void)
497497
msg.cmd = IPMI_WDOG_RESET_TIMER;
498498
msg.data = NULL;
499499
msg.data_len = 0;
500-
atomic_inc(&panic_done_count);
500+
atomic_add(2, &panic_done_count);
501501
rv = ipmi_request_supply_msgs(watchdog_user,
502502
(struct ipmi_addr *) &addr,
503503
0,
@@ -507,7 +507,7 @@ static void panic_halt_ipmi_heartbeat(void)
507507
&panic_halt_heartbeat_recv_msg,
508508
1);
509509
if (rv)
510-
atomic_dec(&panic_done_count);
510+
atomic_sub(2, &panic_done_count);
511511
}
512512

513513
static struct ipmi_smi_msg panic_halt_smi_msg = {
@@ -531,12 +531,12 @@ static void panic_halt_ipmi_set_timeout(void)
531531
/* Wait for the messages to be free. */
532532
while (atomic_read(&panic_done_count) != 0)
533533
ipmi_poll_interface(watchdog_user);
534-
atomic_inc(&panic_done_count);
534+
atomic_add(2, &panic_done_count);
535535
rv = __ipmi_set_timeout(&panic_halt_smi_msg,
536536
&panic_halt_recv_msg,
537537
&send_heartbeat_now);
538538
if (rv) {
539-
atomic_dec(&panic_done_count);
539+
atomic_sub(2, &panic_done_count);
540540
pr_warn("Unable to extend the watchdog timeout\n");
541541
} else {
542542
if (send_heartbeat_now)

0 commit comments

Comments
 (0)