All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corey Minyard <corey@minyard.net>
To: Jian Zhang <zhangjian.3032@bytedance.com>
Cc: openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [RFC] ipmi: ipmi_ssif: require minimum response length
Date: Tue, 3 Mar 2026 07:50:21 -0600	[thread overview]
Message-ID: <aabnHaOxgqHOxFTl@mail.minyard.net> (raw)
In-Reply-To: <20260302061746.1579192-1-zhangjian.3032@bytedance.com>

On Mon, Mar 02, 2026 at 02:17:46PM +0800, Jian Zhang wrote:
> 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.

Well that's unfriendly of them.

Anyway, I see the issue.  I would ask a couple of things:

Can you add a comment before this "if" statement so people in the future
know why it's this way?  Otherwise it's a bit mysterious.

Wouldn't the i2c_smbus_read_block_data() in ipmi_ssif_thread() have the
same issue?  We should fix all of these if so.

Thanks,

-corey

> 
> Signed-off-by: Jian Zhang <zhangjian.3032@bytedance.com>
> ---
>  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

  reply	other threads:[~2026-03-03 13:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02  6:17 [RFC] ipmi: ipmi_ssif: require minimum response length Jian Zhang
2026-03-03 13:50 ` Corey Minyard [this message]
2026-03-04  2:35   ` ByteDance
2026-03-04  6:11     ` ByteDance

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aabnHaOxgqHOxFTl@mail.minyard.net \
    --to=corey@minyard.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    --cc=zhangjian.3032@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.