A valid IPMI over SSIF response must contain at least three bytes
(NetFn/LUN, Command and Completion Code).

Some DMA-only I2C controllers may return short reads instead of a
proper NACK when the response is not ready. Treat such short reads
as incomplete and retry until a full response is received.

Signed-off-by: Jian Zhang <[email protected]>
---
 drivers/char/ipmi/ipmi_ssif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index 37a5cb5c53f1..64ee939a7a4b 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1300,7 +1300,7 @@ static int read_response(struct i2c_client *client, 
unsigned char *resp)
        while (retry_cnt > 0) {
                ret = i2c_smbus_read_block_data(client, SSIF_IPMI_RESPONSE,
                                                resp);
-               if (ret > 0)
+               if (ret >= 3)
                        break;
                msleep(SSIF_MSG_MSEC);
                retry_cnt--;
-- 
2.20.1


_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer

Reply via email to