]> git.ipfire.org Git - thirdparty/kernel/stable.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>
Thu, 27 Jul 2017 22:06:05 +0000 (15:06 -0700)
commitab8e00991809b2c5953fa49c967df14532542183
treee29c96f638980a7c938d4a6b0b0d291e24bee501
parentf883b509b48ba07cc52b6cd3d32c84b99f323487
usb: storage: return on error to avoid a null pointer dereference

commit 446230f52a5bef593554510302465eabab45a372 upstream.

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/isd200.c