scsi: ufs: Correct the LUN used in eh_device_reset_handler() callback
authorCan Guo <cang@codeaurora.org>
Mon, 28 Dec 2020 12:04:36 +0000 (04:04 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Jan 2021 10:54:58 +0000 (11:54 +0100)
commit2536194bb3b099cc9a9037009b86e7ccfb81461c
tree6bef0a3cc65b0946e3445719a86dc1ac627d9927
parent62985a33c6a245561f92ffbd7c5943cd8b552c5e
scsi: ufs: Correct the LUN used in eh_device_reset_handler() callback

[ Upstream commit 35fc4cd34426c242ab015ef280853b7bff101f48 ]

Users can initiate resets to specific SCSI device/target/host through
IOCTL. When this happens, the SCSI cmd passed to eh_device/target/host
_reset_handler() callbacks is initialized with a request whose tag is -1.
In this case it is not right for eh_device_reset_handler() callback to
count on the LUN get from hba->lrb[-1]. Fix it by getting LUN from the SCSI
device associated with the SCSI cmd.

Link: https://lore.kernel.org/r/1609157080-26283-1-git-send-email-cang@codeaurora.org
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.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