OSDN Git Service

scsi: ufs: Fix unexpected values from ufshcd_read_desc_param()
authorCan Guo <cang@codeaurora.org>
Thu, 22 Oct 2020 05:59:00 +0000 (22:59 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 19 Nov 2020 03:53:56 +0000 (22:53 -0500)
commit1699f980d87fb678a669490462cf0b9517c1fb47
tree8c3a22eee400dc62cddc0a0653e19652cc01293a
parentf36199355c64a39fe82cfddc7623d827c7e050da
scsi: ufs: Fix unexpected values from ufshcd_read_desc_param()

WB-related sysfs entries can be accessed even when an UFS device does not
support the feature. The descriptors which are not supported by the UFS
device may be wrongly reported when they are accessed from their
corrsponding sysfs entries. Fix it by adding a sanity check of parameter
offset against the actual decriptor length.

Link: https://lore.kernel.org/r/1603346348-14149-1-git-send-email-cang@codeaurora.org
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Acked-by: Daejun Park <daejun7.park@samsung.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c