[SCSI] Avoid dangling pointer in scsi_requeue_command()
authorBart Van Assche <bvanassche@acm.org>
Fri, 29 Jun 2012 15:34:26 +0000 (15:34 +0000)
committerJames Bottomley <JBottomley@Parallels.com>
Fri, 20 Jul 2012 07:58:40 +0000 (08:58 +0100)
commit940f5d47e2f2e1fa00443921a0abf4822335b54d
treee653ab9f2313c1fec3ab73433abecf5bda3003c3
parent67bd94130015c507011af37858989b199c52e1de
[SCSI] Avoid dangling pointer in scsi_requeue_command()

When we call scsi_unprep_request() the command associated with the request
gets destroyed and therefore drops its reference on the device.  If this was
the only reference, the device may get released and we end up with a NULL
pointer deref when we call blk_requeue_request.

Reported-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Tejun Heo <tj@kernel.org>
Cc: <stable@kernel.org>
[jejb: enhance commend and add commit log for stable]
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/scsi_lib.c