scsi: sd: improve TUR handling in sd_check_events
authorChristoph Hellwig <hch@lst.de>
Tue, 14 Feb 2017 19:15:56 +0000 (20:15 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 23 Feb 2017 00:34:17 +0000 (19:34 -0500)
commit6fa2b8f9e3ae8dd770d8fa264825f86b146381c8
treef685aa0424ea584c1d95a8d585ec12fa2e1b5c20
parent148cff67b401e2229c076c0ea418712654be77e4
scsi: sd: improve TUR handling in sd_check_events

Remove bogus evaluations of retval and sshdr when the device is offline,
and fix a possible NULL pointer dereference by allocating the 8 byte
sized sense header on stack.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c