From: Kiwoong Kim <kwmad.kim@samsung.com>
To: linux-scsi@vger.kernel.org, jejb@linux.ibm.com,
martin.petersen@oracle.com
Cc: Kiwoong Kim <kwmad.kim@samsung.com>
Subject: [PATCH] ufs: fix a bug on printing PRDT
Date: Wed, 19 Feb 2020 08:31:15 +0900 [thread overview]
Message-ID: <20200218233115.8185-1-kwmad.kim@samsung.com> (raw)
In-Reply-To: CGME20200218233124epcas2p3888d2788d42af542cde915df4c4baf23@epcas2p3.samsung.com
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.
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
---
drivers/scsi/ufs/ufshcd.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index f4aa10fdbb0c..94c4a0f9fd9b 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -462,8 +462,12 @@ 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);
+ if (hba->quirks & UFSHCD_QUIRK_PRDT_BYTE_GRAN)
+ prdt_length = le16_to_cpu(lrbp->utr_descriptor_ptr->prd_table_length)
+ / sizeof(struct ufshcd_sg_entry);
+ else
+ prdt_length = le16_to_cpu(lrbp->utr_descriptor_ptr->prd_table_length);
+
dev_err(hba->dev,
"UPIU[%d] - PRDT - %d entries phys@0x%llx\n",
tag, prdt_length,
--
2.14.2
next parent reply other threads:[~2020-02-18 23:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200218233124epcas2p3888d2788d42af542cde915df4c4baf23@epcas2p3.samsung.com>
2020-02-18 23:31 ` Kiwoong Kim [this message]
2020-02-18 23:38 ` [PATCH] ufs: fix a bug on printing PRDT Christoph Hellwig
2020-02-18 23:55 ` Kiwoong Kim
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=20200218233115.8185-1-kwmad.kim@samsung.com \
--to=kwmad.kim@samsung.com \
--cc=jejb@linux.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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