SCSI: scsi_lib: fix potential NULL dereference
commita488d32120a22ca2a2f436ab91947bcb352ee7cf
authorJiri Slaby <jirislaby@gmail.com>
Wed, 23 Sep 2009 14:15:35 +0000 (23 16:15 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 9 Dec 2011 17:21:46 +0000 (9 09:21 -0800)
treee4b5bd8846835da0c2a68911299701c7e1ebab72
parent0e7dfcd7c4b28102af501f57fd27ab2f99497148
SCSI: scsi_lib: fix potential NULL dereference

commit 03b147083a2f9a2a3fbbd2505fa88ffa3c6ab194 upstream.

Stanse found a potential NULL dereference in scsi_kill_request.

Instead of triggering BUG() in 'if (unlikely(cmd == NULL))' branch,
the kernel will Oops earlier on cmd dereference.

Move the dereferences after the if.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/scsi/scsi_lib.c