Skip to content

Commit 9a66e6b

Browse files
committed
Merge tag 'nvme-5.13-2021-05-20' of git://git.infradead.org/nvme into block-5.13
Pull NVMe fixes from Christoph: "nvme fixes for Linux 5.13: - nvme-tcp corruption and timeout fixes (Sagi Grimberg, Keith Busch) - nvme-fc teardown fix (James Smart) - nvmet/nvme-loop memory leak fixes (Wu Bo)" * tag 'nvme-5.13-2021-05-20' of git://git.infradead.org/nvme: nvme-fc: clear q_live at beginning of association teardown nvme-tcp: rerun io_work if req_list is not empty nvme-tcp: fix possible use-after-completion nvme-loop: fix memory leak in nvme_loop_create_ctrl() nvmet: fix memory leak in nvmet_alloc_ctrl()
2 parents 4bc2082 + a7d1391 commit 9a66e6b

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

drivers/nvme/host/fc.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,6 +2461,18 @@ nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved)
24612461
static void
24622462
__nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues)
24632463
{
2464+
int q;
2465+
2466+
/*
2467+
* if aborting io, the queues are no longer good, mark them
2468+
* all as not live.
2469+
*/
2470+
if (ctrl->ctrl.queue_count > 1) {
2471+
for (q = 1; q < ctrl->ctrl.queue_count; q++)
2472+
clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[q].flags);
2473+
}
2474+
clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags);
2475+
24642476
/*
24652477
* If io queues are present, stop them and terminate all outstanding
24662478
* ios on them. As FC allocates FC exchange for each io, the

drivers/nvme/host/tcp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,6 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
943943
if (ret <= 0)
944944
return ret;
945945

946-
nvme_tcp_advance_req(req, ret);
947946
if (queue->data_digest)
948947
nvme_tcp_ddgst_update(queue->snd_hash, page,
949948
offset, ret);
@@ -960,6 +959,7 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
960959
}
961960
return 1;
962961
}
962+
nvme_tcp_advance_req(req, ret);
963963
}
964964
return -EAGAIN;
965965
}
@@ -1140,7 +1140,8 @@ static void nvme_tcp_io_work(struct work_struct *w)
11401140
pending = true;
11411141
else if (unlikely(result < 0))
11421142
break;
1143-
}
1143+
} else
1144+
pending = !llist_empty(&queue->req_list);
11441145

11451146
result = nvme_tcp_try_recv(queue);
11461147
if (result > 0)

drivers/nvme/target/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
13721372
goto out_free_changed_ns_list;
13731373

13741374
if (subsys->cntlid_min > subsys->cntlid_max)
1375-
goto out_free_changed_ns_list;
1375+
goto out_free_sqs;
13761376

13771377
ret = ida_simple_get(&cntlid_ida,
13781378
subsys->cntlid_min, subsys->cntlid_max,

drivers/nvme/target/loop.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,10 @@ static struct nvme_ctrl *nvme_loop_create_ctrl(struct device *dev,
590590

591591
ret = nvme_init_ctrl(&ctrl->ctrl, dev, &nvme_loop_ctrl_ops,
592592
0 /* no quirks, we're perfect! */);
593-
if (ret)
593+
if (ret) {
594+
kfree(ctrl);
594595
goto out;
596+
}
595597

596598
if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING))
597599
WARN_ON_ONCE(1);

0 commit comments

Comments
 (0)