]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: ufs: Fix memory corruption by ufshcd_read_desc_param()
authorBart Van Assche <bvanassche@acm.org>
Thu, 22 Jul 2021 03:34:22 +0000 (20:34 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 3 Aug 2021 01:43:57 +0000 (21:43 -0400)
commitd8a8f6a15d2e332475daf37800a02839bee7c149
tree3ef3cda72f95c1ebd378f720144c9f0b5077063a
parent657dbb827d2aa2e5c9362767c82042757f625c9d
scsi: ufs: Fix memory corruption by ufshcd_read_desc_param()

If param_offset > buff_len then the memcpy() statement in
ufshcd_read_desc_param() corrupts memory since it copies 256 + buff_len -
param_offset bytes into a buffer with size buff_len.  Since param_offset <
256 this results in writing past the bound of the output buffer.

Link: https://lore.kernel.org/r/20210722033439.26550-2-bvanassche@acm.org
Fixes: ca2a6559c28f ("scsi: ufs: Fix potential NULL pointer access during memcpy")
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Daejun Park <daejun7.park@samsung.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c