提交 024ca901 编写于 作者: B Bart Van Assche 提交者: Roland Dreier

IB/srp: Fix a sporadic crash triggered by cable pulling

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: NSagi Grimberg <sagig@mellanox.com>
Reference: http://thread.gmane.org/gmane.linux.drivers.rdma/19068/focus=19069Signed-off-by: NBart Van Assche <bvanassche@acm.org>
Reviewed-by: NSagi Grimberg <sagig@mellanox.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: NRoland Dreier <roland@purestorage.com>
上级 d6d211db
......@@ -1594,6 +1594,12 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册