summaryrefslogtreecommitdiff
path: root/drivers/scsi/ufs/ufshcd.c
diff options
context:
space:
mode:
authorKiwoong Kim <kwmad.kim@samsung.com>2020-02-19 10:16:33 +0900
committerEric Biggers <ebiggers@google.com>2020-03-03 13:10:06 -0800
commite5f689a1e13ab2f99e1488180d2d8099a9246582 (patch)
treeb5ec99f0687dab491491ecd59fe0149f3355c6f8 /drivers/scsi/ufs/ufshcd.c
parenta13dee535e7c54f8e0ffcd934432eeb9e19f180d (diff)
FROMLIST: ufs: fix a bug on printing PRDT
In some architectures, an unit of PRDTO and PRDTL in UFSHCI spec assume bytes, not double word specified in the spec. W/o this patch, when the driver executes this, kernel panic occurres because of abnormal accesses. Bug: 149797634 Link: https://lore.kernel.org/linux-scsi/20200218224307.8017-1-kwmad.kim@samsung.com/ Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> (cherry picked from android-mainline commit 8ec7bddd873f393ea94a3bc9dde9781e5e0fbfe1) Change-Id: I58ffa07535df8011b8d357135b80030833e725f9 Signed-off-by: Eric Biggers <ebiggers@google.com>
Diffstat (limited to 'drivers/scsi/ufs/ufshcd.c')
-rw-r--r--drivers/scsi/ufs/ufshcd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index d360d0669527..11ae1e689f41 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -403,8 +403,11 @@ void ufshcd_print_trs(struct ufs_hba *hba, unsigned long bitmap, bool pr_prdt)
ufshcd_hex_dump("UPIU RSP: ", lrbp->ucd_rsp_ptr,
sizeof(struct utp_upiu_rsp));
- prdt_length = le16_to_cpu(
- lrbp->utr_descriptor_ptr->prd_table_length);
+ prdt_length =
+ le16_to_cpu(lrbp->utr_descriptor_ptr->prd_table_length);
+ if (hba->quirks & UFSHCD_QUIRK_PRDT_BYTE_GRAN)
+ prdt_length /= sizeof(struct ufshcd_sg_entry);
+
dev_err(hba->dev,
"UPIU[%d] - PRDT - %d entries phys@0x%llx\n",
tag, prdt_length,