diff options
author | Bart Van Assche <bvanassche@acm.org> | 2014-05-20 15:03:49 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-06 18:54:14 -0700 |
commit | 364461b2890b3f763872a5d05139430b5c67da94 (patch) | |
tree | 5ad864a7d61ae5d5e269ac1d9608bb5d0406da1a /drivers/infiniband | |
parent | a533eba6682f1dc89bfa5dc6e16e18ea257dd4d0 (diff) | |
download | linux-3.10-364461b2890b3f763872a5d05139430b5c67da94.tar.gz linux-3.10-364461b2890b3f763872a5d05139430b5c67da94.tar.bz2 linux-3.10-364461b2890b3f763872a5d05139430b5c67da94.zip |
IB/srp: Fix a sporadic crash triggered by cable pulling
commit 024ca90151f5e4296d30f72c13ff9a075e23c9ec upstream.
Avoid that the loops that iterate over the request ring can encounter
a pointer to a SCSI command in req->scmnd that is no longer associated
with that request. If the function srp_unmap_data() is invoked twice
for a SCSI command that is not in flight then that would cause
ib_fmr_pool_unmap() to be invoked with an invalid pointer as argument,
resulting in a kernel oops.
Reported-by: Sagi Grimberg <sagig@mellanox.com>
Reference: http://thread.gmane.org/gmane.linux.drivers.rdma/19068/focus=19069
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 793ac5dcee7..1954daac0b5 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1409,6 +1409,12 @@ err_unmap: err_iu: srp_put_tx_iu(target, iu, SRP_IU_CMD); + /* + * Avoid that the loops that iterate over the request ring can + * encounter a dangling SCSI command pointer. + */ + req->scmnd = NULL; + spin_lock_irqsave(&target->lock, flags); list_add(&req->list, &target->free_reqs); |