public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: core: Add NULL check in ufshcd_mcq_compl_pending_transfer()
@ 2025-04-12 19:59 Chenyuan Yang
  2025-04-14  3:50 ` Peter Wang (王信友)
  2025-04-14 16:27 ` Bart Van Assche
  0 siblings, 2 replies; 3+ messages in thread
From: Chenyuan Yang @ 2025-04-12 19:59 UTC (permalink / raw)
  To: alim.akhtar, avri.altman, bvanassche, James.Bottomley,
	martin.petersen, peter.wang, manivannan.sadhasivam, stanley.chu,
	quic_cang, quic_nguyenb
  Cc: linux-scsi, linux-kernel, Chenyuan Yang

Add a NULL check for the returned hwq pointer by ufshcd_mcq_req_to_hwq().

This is similar to the fix in commit 74736103fb41
("scsi: ufs: core: Fix ufshcd_abort_one racing issue").

Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
Fixes: ab248643d3d6 ("scsi: ufs: core: Add error handling for MCQ mode")
---
 drivers/ufs/core/ufshcd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 0534390c2a35..fd39e10c2043 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -5692,6 +5692,8 @@ static void ufshcd_mcq_compl_pending_transfer(struct ufs_hba *hba,
 			continue;
 
 		hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(cmd));
+		if (!hwq)
+			continue;
 
 		if (force_compl) {
 			ufshcd_mcq_compl_all_cqes_lock(hba, hwq);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: ufs: core: Add NULL check in ufshcd_mcq_compl_pending_transfer()
  2025-04-12 19:59 [PATCH] scsi: ufs: core: Add NULL check in ufshcd_mcq_compl_pending_transfer() Chenyuan Yang
@ 2025-04-14  3:50 ` Peter Wang (王信友)
  2025-04-14 16:27 ` Bart Van Assche
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Wang (王信友) @ 2025-04-14  3:50 UTC (permalink / raw)
  To: avri.altman@wdc.com, quic_cang@quicinc.com,
	quic_nguyenb@quicinc.com, chenyuan0y@gmail.com,
	bvanassche@acm.org, manivannan.sadhasivam@linaro.org,
	alim.akhtar@samsung.com, Stanley Chu (朱原陞),
	martin.petersen@oracle.com, James.Bottomley@HansenPartnership.com
  Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org

On Sat, 2025-04-12 at 14:59 -0500, Chenyuan Yang wrote:
> 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> Add a NULL check for the returned hwq pointer by
> ufshcd_mcq_req_to_hwq().
> 
> This is similar to the fix in commit 74736103fb41
> ("scsi: ufs: core: Fix ufshcd_abort_one racing issue").
> 
> Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
> Fixes: ab248643d3d6 ("scsi: ufs: core: Add error handling for MCQ
> mode")
> ---
>  drivers/ufs/core/ufshcd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 0534390c2a35..fd39e10c2043 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -5692,6 +5692,8 @@ static void
> ufshcd_mcq_compl_pending_transfer(struct ufs_hba *hba,
>                         continue;
> 
>                 hwq = ufshcd_mcq_req_to_hwq(hba,
> scsi_cmd_to_rq(cmd));
> +               if (!hwq)
> +                       continue;
> 
>                 if (force_compl) {
>                         ufshcd_mcq_compl_all_cqes_lock(hba, hwq);
> --
> 2.34.1
> 

Reviewed-by: Peter Wang <peter.wang@mediatek.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: ufs: core: Add NULL check in ufshcd_mcq_compl_pending_transfer()
  2025-04-12 19:59 [PATCH] scsi: ufs: core: Add NULL check in ufshcd_mcq_compl_pending_transfer() Chenyuan Yang
  2025-04-14  3:50 ` Peter Wang (王信友)
@ 2025-04-14 16:27 ` Bart Van Assche
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2025-04-14 16:27 UTC (permalink / raw)
  To: Chenyuan Yang, alim.akhtar, avri.altman, James.Bottomley,
	martin.petersen, peter.wang, manivannan.sadhasivam, stanley.chu,
	quic_cang, quic_nguyenb
  Cc: linux-scsi, linux-kernel

On 4/12/25 12:59 PM, Chenyuan Yang wrote:
> Add a NULL check for the returned hwq pointer by ufshcd_mcq_req_to_hwq().
> 
> This is similar to the fix in commit 74736103fb41
> ("scsi: ufs: core: Fix ufshcd_abort_one racing issue").
> 
> Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
> Fixes: ab248643d3d6 ("scsi: ufs: core: Add error handling for MCQ mode")
> ---
>   drivers/ufs/core/ufshcd.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 0534390c2a35..fd39e10c2043 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -5692,6 +5692,8 @@ static void ufshcd_mcq_compl_pending_transfer(struct ufs_hba *hba,
>   			continue;
>   
>   		hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(cmd));
> +		if (!hwq)
> +			continue;
>   
>   		if (force_compl) {
>   			ufshcd_mcq_compl_all_cqes_lock(hba, hwq);

Reviewed-by: Bart Van Assche <bvanassche@acm.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-14 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-12 19:59 [PATCH] scsi: ufs: core: Add NULL check in ufshcd_mcq_compl_pending_transfer() Chenyuan Yang
2025-04-14  3:50 ` Peter Wang (王信友)
2025-04-14 16:27 ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox