Skip to contentSkip to conversation

ipmi: ssif_bmc: Fix new request loss when bmc ready for a response

PATCH New Quan Nguyen 1 participant 1 message Jan 7, 2025 IPMI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipmi: ssif_bmc: Fix new request loss when bmc ready for a response

Cosmo found that when there is a new request comes in while BMC is ready for a response, the complete_response(), which is called to complete the pending response, would accidentally clear out that new request and force ssif_bmc to move back to abort state again.

This commit is to address that issue.

Fixes dd2bc5cc9e25 ("ipmi: ssif_bmc: Add SSIF BMC driver")
---
 drivers/char/ipmi/ssif_bmc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/char/ipmi/ssif_bmc.c +3 -2
index a14fafc583d4..310f17dd9511 100644
@@ -292,7 +292,6 @@ static void complete_response(struct ssif_bmc_ctx *ssif_bmc)
 	ssif_bmc->nbytes_processed = 0;
 	ssif_bmc->remain_len = 0;
 	ssif_bmc->busy = false;
-	memset(&ssif_bmc->part_buf, 0, sizeof(struct ssif_part_buffer));
 	wake_up_all(&ssif_bmc->wait_queue);
 }
 
@@ -744,9 +743,11 @@ static void on_stop_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val)
 			ssif_bmc->aborting = true;
 		}
 	} else if (ssif_bmc->state == SSIF_RES_SENDING) {
-		if (ssif_bmc->is_singlepart_read || ssif_bmc->block_num == 0xFF)
+		if (ssif_bmc->is_singlepart_read || ssif_bmc->block_num == 0xFF) {
+			memset(&ssif_bmc->part_buf, 0, sizeof(struct ssif_part_buffer));
 			/* Invalidate response buffer to denote it is sent */
 			complete_response(ssif_bmc);
+		}
 		ssif_bmc->state = SSIF_READY;
 	}
 
Signature · 1 line
2.35.1