mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com>
To: Hongling Zeng <zenghongling@kylinos.cn>,
	alexandre.belloni@bootlin.com, Frank.Li@nxp.com,
	amergnat@baylibre.com, tze.yee.ng@altera.com,
	adrian.ho.yin.ng@altera.com
Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org,
	zhongling0719@126.com
Subject: Re: [PATCH] i3c: fix potential NULL dereference in send_ccc_cmd_locked
Date: Tue, 28 Jul 2026 15:57:46 +0530	[thread overview]
Message-ID: <5ac5f386-1b95-4b30-a7e2-c246c9bfad68@oss.qualcomm.com> (raw)
In-Reply-To: <20260728063045.73473-1-zenghongling@kylinos.cn>



On 7/28/2026 12:00 PM, Hongling Zeng wrote:
> The retry loop added in commit 02cc832191dd ("i3c: master: Validate GET
>   CCC payload length and retry Direct GET once") resets payload actual_len
> before each attempt. However, cmd->dests is only validated for DIRECT
> CCC commands (I3C_CCC_DIRECT bit set). For broadcast commands, dests
> can be NULL while ndests > 0, causing a NULL pointer dereference at
> cmd->dests[i].payload.actual_len.
> 
> Fix by restricting the actual_len reset to DIRECT commands.
> 
> Fixes: 02cc832191dd ("i3c: master: Validate GET CCC payload length and retry Direct GET once")
> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
> ---
>   drivers/i3c/master.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index fd3e79d10c84..21212c34c31e 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -1051,7 +1051,7 @@ static int i3c_master_send_ccc_cmd_locked(struct i3c_master_controller *master,
>   	for (attempt = 0; attempt < max_attempts; attempt++) {
>   		unsigned int i;
>   
> -		if (cmd->rnw)
> +		if (cmd->rnw && (cmd->id & I3C_CCC_DIRECT))

Please review this recent fix @
https://lore.kernel.org/all/amJau9LgehYLnR20@lizhi-Precision-Tower-5810/

>   			for (i = 0; i < cmd->ndests; i++)
>   				cmd->dests[i].payload.actual_len = 0;
>   


  reply	other threads:[~2026-07-28 10:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28  6:30 Hongling Zeng
2026-07-28 10:27 ` Mukesh Savaliya [this message]
2026-07-30  2:31   ` Hongling Zeng

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=5ac5f386-1b95-4b30-a7e2-c246c9bfad68@oss.qualcomm.com \
    --to=mukesh.savaliya@oss.qualcomm.com \
    --cc=Frank.Li@nxp.com \
    --cc=adrian.ho.yin.ng@altera.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=amergnat@baylibre.com \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tze.yee.ng@altera.com \
    --cc=zenghongling@kylinos.cn \
    --cc=zhongling0719@126.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®