* [PATCH] scsi: ufs: Fix referencing invalid rsp field
[not found] <CGME20220519060529epcms2p8941ce10ed8cfb50c142140f1f69f8612@epcms2p8>
@ 2022-05-19 6:05 ` Daejun Park
2022-05-19 6:37 ` Avri Altman
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Daejun Park @ 2022-05-19 6:05 UTC (permalink / raw)
To: ALIM AKHTAR, avri.altman, jejb, martin.petersen, Daejun Park,
beanhuo, bvanassche
Cc: linux-scsi, linux-kernel
This is a patch for fixing referencing sense data when it is invalid.
When the length of the data segment is 0, there is no valid information in
the rsp field, so ufshpb_rsp_upiu() is returned without additional
operation.
Signed-off-by: Daejun Park <daejun7.park@samsung.com>
---
drivers/scsi/ufs/ufshpb.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c
index f1f65383e97d..8882b47f76d3 100644
--- a/drivers/scsi/ufs/ufshpb.c
+++ b/drivers/scsi/ufs/ufshpb.c
@@ -1304,6 +1304,13 @@ void ufshpb_rsp_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
struct utp_hpb_rsp *rsp_field = &lrbp->ucd_rsp_ptr->hr;
int data_seg_len;
+ data_seg_len = be32_to_cpu(lrbp->ucd_rsp_ptr->header.dword_2)
+ & MASK_RSP_UPIU_DATA_SEG_LEN;
+
+ /* If data segment length is zero, rsp_field is not valid */
+ if (!data_seg_len)
+ return;
+
if (unlikely(lrbp->lun != rsp_field->lun)) {
struct scsi_device *sdev;
bool found = false;
@@ -1338,18 +1345,6 @@ void ufshpb_rsp_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
return;
}
- data_seg_len = be32_to_cpu(lrbp->ucd_rsp_ptr->header.dword_2)
- & MASK_RSP_UPIU_DATA_SEG_LEN;
-
- /* To flush remained rsp_list, we queue the map_work task */
- if (!data_seg_len) {
- if (!ufshpb_is_general_lun(hpb->lun))
- return;
-
- ufshpb_kick_map_work(hpb);
- return;
- }
-
BUILD_BUG_ON(sizeof(struct utp_hpb_rsp) != UTP_HPB_RSP_SIZE);
if (!ufshpb_is_hpb_rsp_valid(hba, lrbp, rsp_field))
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] scsi: ufs: Fix referencing invalid rsp field
2022-05-19 6:05 ` [PATCH] scsi: ufs: Fix referencing invalid rsp field Daejun Park
@ 2022-05-19 6:37 ` Avri Altman
2022-05-19 6:46 ` Chanho Park
2022-05-20 1:08 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Avri Altman @ 2022-05-19 6:37 UTC (permalink / raw)
To: daejun7.park, ALIM AKHTAR, jejb, martin.petersen, beanhuo, bvanassche
Cc: linux-scsi, linux-kernel
> This is a patch for fixing referencing sense data when it is invalid.
> When the length of the data segment is 0, there is no valid information in
> the rsp field, so ufshpb_rsp_upiu() is returned without additional
> operation.
>
> Signed-off-by: Daejun Park <daejun7.park@samsung.com>
Acked-by: Avri Altman <avri.altman@wdc.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] scsi: ufs: Fix referencing invalid rsp field
2022-05-19 6:05 ` [PATCH] scsi: ufs: Fix referencing invalid rsp field Daejun Park
2022-05-19 6:37 ` Avri Altman
@ 2022-05-19 6:46 ` Chanho Park
2022-05-20 1:08 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Chanho Park @ 2022-05-19 6:46 UTC (permalink / raw)
To: daejun7.park, 'ALIM AKHTAR',
avri.altman, jejb, martin.petersen, beanhuo, bvanassche
Cc: linux-scsi, linux-kernel
> This is a patch for fixing referencing sense data when it is invalid.
> When the length of the data segment is 0, there is no valid information in
> the rsp field, so ufshpb_rsp_upiu() is returned without additional
> operation.
>
You should put a proper fix tag to be applied the corresponding stable tree.
See https://www.kernel.org/doc/html/latest/process/submitting-patches.html
Fixes: 4b5f49079c52 ("scsi: ufs: ufshpb: L2P map management for HPB read")
Best Regards,
Chanho Park
> Signed-off-by: Daejun Park <daejun7.park@samsung.com>
> ---
> drivers/scsi/ufs/ufshpb.c | 19 +++++++------------
> 1 file changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c index
> f1f65383e97d..8882b47f76d3 100644
> --- a/drivers/scsi/ufs/ufshpb.c
> +++ b/drivers/scsi/ufs/ufshpb.c
> @@ -1304,6 +1304,13 @@ void ufshpb_rsp_upiu(struct ufs_hba *hba, struct
> ufshcd_lrb *lrbp)
> struct utp_hpb_rsp *rsp_field = &lrbp->ucd_rsp_ptr->hr;
> int data_seg_len;
>
> + data_seg_len = be32_to_cpu(lrbp->ucd_rsp_ptr->header.dword_2)
> + & MASK_RSP_UPIU_DATA_SEG_LEN;
> +
> + /* If data segment length is zero, rsp_field is not valid */
> + if (!data_seg_len)
> + return;
> +
> if (unlikely(lrbp->lun != rsp_field->lun)) {
> struct scsi_device *sdev;
> bool found = false;
> @@ -1338,18 +1345,6 @@ void ufshpb_rsp_upiu(struct ufs_hba *hba, struct
> ufshcd_lrb *lrbp)
> return;
> }
>
> - data_seg_len = be32_to_cpu(lrbp->ucd_rsp_ptr->header.dword_2)
> - & MASK_RSP_UPIU_DATA_SEG_LEN;
> -
> - /* To flush remained rsp_list, we queue the map_work task */
> - if (!data_seg_len) {
> - if (!ufshpb_is_general_lun(hpb->lun))
> - return;
> -
> - ufshpb_kick_map_work(hpb);
> - return;
> - }
> -
> BUILD_BUG_ON(sizeof(struct utp_hpb_rsp) != UTP_HPB_RSP_SIZE);
>
> if (!ufshpb_is_hpb_rsp_valid(hba, lrbp, rsp_field))
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: ufs: Fix referencing invalid rsp field
2022-05-19 6:05 ` [PATCH] scsi: ufs: Fix referencing invalid rsp field Daejun Park
2022-05-19 6:37 ` Avri Altman
2022-05-19 6:46 ` Chanho Park
@ 2022-05-20 1:08 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-05-20 1:08 UTC (permalink / raw)
To: avri.altman, Daejun Park, jejb, ALIM AKHTAR, bvanassche, beanhuo
Cc: Martin K . Petersen, linux-kernel, linux-scsi
On Thu, 19 May 2022 15:05:29 +0900, Daejun Park wrote:
> This is a patch for fixing referencing sense data when it is invalid.
> When the length of the data segment is 0, there is no valid information in
> the rsp field, so ufshpb_rsp_upiu() is returned without additional
> operation.
>
>
Applied to 5.18/scsi-fixes, thanks!
[1/1] scsi: ufs: Fix referencing invalid rsp field
https://git.kernel.org/mkp/scsi/c/d5d92b644084
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-20 1:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20220519060529epcms2p8941ce10ed8cfb50c142140f1f69f8612@epcms2p8>
2022-05-19 6:05 ` [PATCH] scsi: ufs: Fix referencing invalid rsp field Daejun Park
2022-05-19 6:37 ` Avri Altman
2022-05-19 6:46 ` Chanho Park
2022-05-20 1:08 ` Martin K. Petersen
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.