]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
usb: storage: return on error to avoid a null pointer dereference
authorColin Ian King <colin.king@canonical.com>
Thu, 6 Jul 2017 15:06:32 +0000 (16:06 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Jul 2017 11:11:57 +0000 (13:11 +0200)
commit446230f52a5bef593554510302465eabab45a372
tree77ae0ac884bb89ddb91c43d44808b4af44f4e4f4
parent86be7f7b2d940ddc18143061e77989b017d93bf8
usb: storage: return on error to avoid a null pointer dereference

When us->extra is null the driver is not initialized, however, a
later call to osd200_scsi_to_ata is made that dereferences
us->extra, causing a null pointer dereference.  The code
currently detects and reports that the driver is not initialized;
add a return to avoid the subsequent dereference issue in this
check.

Thanks to Alan Stern for pointing out that srb->result needs setting
to DID_ERROR << 16

Detected by CoverityScan, CID#100308 ("Dereference after null check")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: stable <stable@vger.kernel.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/isd200.c