]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: ufs: core: scsi_get_lba() error fix
authorPeter Wang <peter.wang@mediatek.com>
Mon, 7 Mar 2022 11:17:52 +0000 (19:17 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 9 Mar 2022 03:52:09 +0000 (22:52 -0500)
commit6cb13cfb7dfa60adf059c84990af20ca0e7282a6
tree266f499d309c14ed839180a60339acef75b35675
parent067cb732861b33e1db7d1d0413b48f11fd3bc377
scsi: ufs: core: scsi_get_lba() error fix

When ufs initializes without scmd->device->sector_size set, scsi_get_lba()
will get a wrong shift number and trigger an ubsan error.  The shift
exponent 4294967286 is too large for the 64-bit type 'sector_t' (aka
'unsigned long long').

Call scsi_get_lba() only when opcode is READ_10/WRITE_10/UNMAP.

Link: https://lore.kernel.org/r/20220307111752.10465-1-peter.wang@mediatek.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c