libata: fix NULL sdev dereference race in atapi_qc_complete()
authorTejun Heo <tj@kernel.org>
Mon, 1 Nov 2010 10:39:19 +0000 (11:39 +0100)
committerJeff Garzik <jgarzik@redhat.com>
Fri, 12 Nov 2010 22:10:51 +0000 (17:10 -0500)
commit2a5f07b5ec098edc69e05fdd2f35d3fbb1235723
tree28180df99e2b236018c29dd05480b13024159868
parenta0a6da1a735ba66c04019b39cca8f79008d6c434
libata: fix NULL sdev dereference race in atapi_qc_complete()

SCSI commands may be issued between __scsi_add_device() and dev->sdev
assignment, so it's unsafe for ata_qc_complete() to dereference
dev->sdev->locked without checking whether it's NULL or not.  Fix it.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@kernel.org
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/ata/libata-scsi.c