IB/srp: Avoid that sg_reset -d ${srp_device} triggers an infinite loop
commitee92efe41c
upstream. Use different loop variables for the inner and outer loop. This avoids that an infinite loop occurs if there are more RDMA channels than target->req_ring_size. Fixes:d92c0da71a
("IB/srp: Add multichannel support") Cc: <stable@vger.kernel.org> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
aa749266a9
commit
94b7698c3d
@ -2639,7 +2639,7 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
|
|||||||
{
|
{
|
||||||
struct srp_target_port *target = host_to_target(scmnd->device->host);
|
struct srp_target_port *target = host_to_target(scmnd->device->host);
|
||||||
struct srp_rdma_ch *ch;
|
struct srp_rdma_ch *ch;
|
||||||
int i;
|
int i, j;
|
||||||
u8 status;
|
u8 status;
|
||||||
|
|
||||||
shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n");
|
shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n");
|
||||||
@ -2653,8 +2653,8 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
|
|||||||
|
|
||||||
for (i = 0; i < target->ch_count; i++) {
|
for (i = 0; i < target->ch_count; i++) {
|
||||||
ch = &target->ch[i];
|
ch = &target->ch[i];
|
||||||
for (i = 0; i < target->req_ring_size; ++i) {
|
for (j = 0; j < target->req_ring_size; ++j) {
|
||||||
struct srp_request *req = &ch->req_ring[i];
|
struct srp_request *req = &ch->req_ring[j];
|
||||||
|
|
||||||
srp_finish_req(ch, req, scmnd->device, DID_RESET << 16);
|
srp_finish_req(ch, req, scmnd->device, DID_RESET << 16);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user