From: Bean Huo <beanhuo@iokpp.de>
To: Ao Sun <ao.sun@transsion.com>,
"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
"avri.altman@sandisk.com" <avri.altman@sandisk.com>,
"bvanassche@acm.org" <bvanassche@acm.org>,
"James.Bottomley@HansenPartnership.com"
<James.Bottomley@HansenPartnership.com>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
"peter.wang@mediatek.com" <peter.wang@mediatek.com>,
"can.guo@oss.qualcomm.com" <can.guo@oss.qualcomm.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Hongyan Xia <hongyan.xia@transsion.com>,
Jiazi Li <jiazi.li@transsion.com>
Subject: Re: [PATCH] scsi: ufs: core: Initialize hba->rpmbs list in ufshcd
Date: Mon, 27 Jul 2026 23:09:07 +0200 [thread overview]
Message-ID: <f818a63492504f213b5e91023617e14138cef020.camel@iokpp.de> (raw)
In-Reply-To: <20260723034440.217-1-ao.sun@transsion.com>
On Thu, 2026-07-23 at 03:45 +0000, Ao Sun wrote:
> From: Ao Sun <ao.sun@transsion.com>
>
> Initialize the hba->rpmbs list in ufshcd_alloc_host() to prevent NULL
> pointer dereference in the device teardown path if ufs_rpmb_probe()
> fails.
>
> Fixes: b06b8c421485 ("scsi: ufs: core: Add OP-TEE based RPMB driver for UFS
> devices")
> Signed-off-by: Jiazi Li <jiazi.li@transsion.com>
> Signed-off-by: Ao Sun <ao.sun@transsion.com>
> ---
> drivers/ufs/core/ufs-rpmb.c | 2 --
> drivers/ufs/core/ufshcd.c | 1 +
> 2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/ufs/core/ufs-rpmb.c b/drivers/ufs/core/ufs-rpmb.c
> index ffad049872b9..62120dc2e9da 100644
> --- a/drivers/ufs/core/ufs-rpmb.c
> +++ b/drivers/ufs/core/ufs-rpmb.c
> @@ -152,8 +152,6 @@ int ufs_rpmb_probe(struct ufs_hba *hba)
> return -EINVAL;
> }
>
> - INIT_LIST_HEAD(&hba->rpmbs);
> -
> struct rpmb_descr descr = {
> .type = RPMB_TYPE_UFS,
> .route_frames = ufs_rpmb_route_frames,
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index d3044a3089b5..60227069db06 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -10988,6 +10988,7 @@ int ufshcd_alloc_host(struct device *dev, struct
> ufs_hba **hba_handle)
> hba->nop_out_timeout = NOP_OUT_TIMEOUT;
> ufshcd_set_sg_entry_size(hba, sizeof(struct ufshcd_sg_entry));
> INIT_LIST_HEAD(&hba->clk_list_head);
> + INIT_LIST_HEAD(&hba->rpmbs);
> spin_lock_init(&hba->outstanding_lock);
>
> *hba_handle = hba;
Thanks for splitting this out, this is much easier to reason about.
For the two lifetime issues Sashiko reported (the container/rdev circular
reference and the devm_kzalloc() ownership), both are real but pre-existing and
independent of this fix. Let's keep this patch focused on the NULL deref and
handle those in the teardown-order series, this one can go in on its own.
Reviewed-by: Bean Huo <beanhuo@micron.com>
Kind regards,
Bean
next prev parent reply other threads:[~2026-07-27 21:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 3:45 Ao Sun
2026-07-27 21:09 ` Bean Huo [this message]
2026-07-29 2:56 ` Martin K. Petersen
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=f818a63492504f213b5e91023617e14138cef020.camel@iokpp.de \
--to=beanhuo@iokpp.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alim.akhtar@samsung.com \
--cc=ao.sun@transsion.com \
--cc=avri.altman@sandisk.com \
--cc=bvanassche@acm.org \
--cc=can.guo@oss.qualcomm.com \
--cc=hongyan.xia@transsion.com \
--cc=jiazi.li@transsion.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=peter.wang@mediatek.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®