]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Dec 2020 09:58:31 +0000 (10:58 +0100)
commitf17c5a3adf66ad59c23580c912a21d22ba2152f2
treecd242c0e33f09f3228456231b66bea5b89410921
parent8b92c5da06131e15535800ff7907dbec0942e0c9
scsi: ufs: Fix unexpected values from ufshcd_read_desc_param()

[ Upstream commit 1699f980d87fb678a669490462cf0b9517c1fb47 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/ufs/ufshcd.c