put stricter guards on queue dead checks
commit1f7d953f4de3f3079b9c83d1a23691d4e8c89650
authorJames Bottomley <James.Bottomley@suse.de>
Fri, 22 Apr 2011 15:39:59 +0000 (22 10:39 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 9 May 2011 23:04:42 +0000 (9 16:04 -0700)
tree6fdef4d2d7022a4fd2073ced9cd554bd90b6df79
parent5c20dc7633ed54a3794378695934ec949b2354d5
put stricter guards on queue dead checks

commit 86cbfb5607d4b81b1a993ff689bbd2addd5d3a9b upstream.

SCSI uses request_queue->queuedata == NULL as a signal that the queue
is dying.  We set this state in the sdev release function.  However,
this allows a small window where we release the last reference but
haven't quite got to this stage yet and so something will try to take
a reference in scsi_request_fn and oops.  It's very rare, but we had a
report here, so we're pushing this as a bug fix

The actual fix is to set request_queue->queuedata to NULL in
scsi_remove_device() before we drop the reference.  This causes
correct automatic rejects from scsi_request_fn as people who hold
additional references try to submit work and prevents anything from
getting a new reference to the sdev that way.

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/scsi/scsi_sysfs.c