From: Bart Van Assche <bvanassche@acm.org>
To: shao.mingyin@zte.com.cn, martin.petersen@oracle.com,
linux-scsi@vger.kernel.org, Stanley Jhu <stanleyjhu@google.com>
Cc: alim.akhtar@samsung.com, avri.altman@wdc.com,
peter.wang@mediatek.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: ufs: core: fix NULL deref in remaining scsi_cmd_priv() callers
Date: Mon, 26 Oct 2026 08:37:58 -0700 [thread overview]
Message-ID: <ae182bf3-2fbd-42d8-a5c1-3792807e45e1@acm.org> (raw)
In-Reply-To: <202610261647385343iIt_Rpe2JeqxY7SCEeUl@zte.com.cn>
On 10/26/26 1:47 AM, shao.mingyin@zte.com.cn wrote:
> From: Shao Mingyin <shao.mingyin@zte.com.cn>
>
> Commit 4cf752f6b99a ("scsi: ufs: core: Fix NULL pointer dereference in
> scsi_cmd_priv() calls") fixed the callers that dereference the command
> pointer returned by ufshcd_tag_to_cmd() via scsi_cmd_priv() without
> checking for NULL first, but three call sites with the same pattern were
> left:
>
> - ufshcd_compl_one_cqe(): scsi_cmd_priv(cmd) runs before the !cmd check.
> - ufshcd_mcq_sq_cleanup(): scsi_cmd_priv(cmd) and scsi_cmd_to_rq(cmd)
> run before the !cmd check.
> - ufshcd_issue_devman_upiu_cmd(): scsi_cmd_priv(cmd) runs before the
> WARN_ON_ONCE(!cmd) check.
>
> Fix these three remaining sites by deferring the pointer arithmetic until
> after the NULL check.
In the Linux kernel, passing NULL to container_of() is safe if the
result of container_of() is not used. The code modified by this patch
does not use the result of container_of() before checking that the
pointer passed to container_of() is not NULL. In other words, this patch
doesn't fix any bugs.
Bart.
prev parent reply other threads:[~2026-10-26 15:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 8:47 shao.mingyin
2026-10-26 14:24 ` Stanley Jhu
2026-10-26 15:37 ` Bart Van Assche [this message]
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=ae182bf3-2fbd-42d8-a5c1-3792807e45e1@acm.org \
--to=bvanassche@acm.org \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=peter.wang@mediatek.com \
--cc=shao.mingyin@zte.com.cn \
--cc=stanleyjhu@google.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®