* [PATCH] IB/srp: Avoid that sg_reset -d ${srp_device} triggers an infinite loop
@ 2018-09-18 1:10 Bart Van Assche
2018-09-19 21:31 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2018-09-18 1:10 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Doug Ledford, linux-rdma, Bart Van Assche, Max Gurtovoy,
Laurence Oberman, stable
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: d92c0da71a35 ("IB/srp: Add multichannel support")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Max Gurtovoy <maxg@mellanox.com>
Cc: Laurence Oberman <loberman@redhat.com>
Cc: <stable@vger.kernel.org>
---
drivers/infiniband/ulp/srp/ib_srp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 444d16520506..0b34e909505f 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -2951,7 +2951,7 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
{
struct srp_target_port *target = host_to_target(scmnd->device->host);
struct srp_rdma_ch *ch;
- int i;
+ int i, j;
u8 status;
shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n");
@@ -2965,8 +2965,8 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
for (i = 0; i < target->ch_count; i++) {
ch = &target->ch[i];
- for (i = 0; i < target->req_ring_size; ++i) {
- struct srp_request *req = &ch->req_ring[i];
+ for (j = 0; j < target->req_ring_size; ++j) {
+ struct srp_request *req = &ch->req_ring[j];
srp_finish_req(ch, req, scmnd->device, DID_RESET << 16);
}
--
2.18.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] IB/srp: Avoid that sg_reset -d ${srp_device} triggers an infinite loop
2018-09-18 1:10 [PATCH] IB/srp: Avoid that sg_reset -d ${srp_device} triggers an infinite loop Bart Van Assche
@ 2018-09-19 21:31 ` Jason Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2018-09-19 21:31 UTC (permalink / raw)
To: Bart Van Assche
Cc: Doug Ledford, linux-rdma, Max Gurtovoy, Laurence Oberman, stable
On Mon, Sep 17, 2018 at 06:10:05PM -0700, Bart Van Assche wrote:
> 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: d92c0da71a35 ("IB/srp: Add multichannel support")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> Cc: Max Gurtovoy <maxg@mellanox.com>
> Cc: Laurence Oberman <loberman@redhat.com>
> Cc: <stable@vger.kernel.org>
> ---
> drivers/infiniband/ulp/srp/ib_srp.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Applied to for-rc, thanks
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-20 3:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-18 1:10 [PATCH] IB/srp: Avoid that sg_reset -d ${srp_device} triggers an infinite loop Bart Van Assche
2018-09-19 21:31 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).