scsi: sd: Fix scsi_mode_sense caller's sshdr use
authorMike Christie <michael.christie@oracle.com>
Wed, 4 Oct 2023 21:00:09 +0000 (16:00 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 13 Oct 2023 20:36:20 +0000 (16:36 -0400)
commitadd2c24d32a38402dfec3c1465f332ab8a769890
tree4cc37ad77f2c7c39dff2f490f6355276d8c2318c
parent0b149cee836aa53989ea089af1cb9d90d7c6ac9e
scsi: sd: Fix scsi_mode_sense caller's sshdr use

The sshdr passed into scsi_execute_cmd is only initialized if
scsi_execute_cmd returns >= 0, and scsi_mode_sense will convert all non
good statuses like check conditions to -EIO. This has scsi_mode_sense
callers that were possibly accessing an uninitialized sshdrs to only
access it if we got -EIO.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20231004210013.5601-9-michael.christie@oracle.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c