Skip to content

Commit

Permalink
Merge tag 'nvme-5.13-2021-05-20' of git://git.infradead.org/nvme into…
Browse files Browse the repository at this point in the history
… 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()
  • Loading branch information
Jens Axboe committed May 20, 2021
2 parents 4bc2082 + a7d1391 commit 9a66e6b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
12 changes: 12 additions & 0 deletions drivers/nvme/host/fc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2461,6 +2461,18 @@ nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved)
static void
__nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues)
{
int q;

/*
* if aborting io, the queues are no longer good, mark them
* all as not live.
*/
if (ctrl->ctrl.queue_count > 1) {
for (q = 1; q < ctrl->ctrl.queue_count; q++)
clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[q].flags);
}
clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags);

/*
* If io queues are present, stop them and terminate all outstanding
* ios on them. As FC allocates FC exchange for each io, the
Expand Down
5 changes: 3 additions & 2 deletions drivers/nvme/host/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,6 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
if (ret <= 0)
return ret;

nvme_tcp_advance_req(req, ret);
if (queue->data_digest)
nvme_tcp_ddgst_update(queue->snd_hash, page,
offset, ret);
Expand All @@ -960,6 +959,7 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
}
return 1;
}
nvme_tcp_advance_req(req, ret);
}
return -EAGAIN;
}
Expand Down Expand Up @@ -1140,7 +1140,8 @@ static void nvme_tcp_io_work(struct work_struct *w)
pending = true;
else if (unlikely(result < 0))
break;
}
} else
pending = !llist_empty(&queue->req_list);

result = nvme_tcp_try_recv(queue);
if (result > 0)
Expand Down
2 changes: 1 addition & 1 deletion drivers/nvme/target/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
goto out_free_changed_ns_list;

if (subsys->cntlid_min > subsys->cntlid_max)
goto out_free_changed_ns_list;
goto out_free_sqs;

ret = ida_simple_get(&cntlid_ida,
subsys->cntlid_min, subsys->cntlid_max,
Expand Down
4 changes: 3 additions & 1 deletion drivers/nvme/target/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,10 @@ static struct nvme_ctrl *nvme_loop_create_ctrl(struct device *dev,

ret = nvme_init_ctrl(&ctrl->ctrl, dev, &nvme_loop_ctrl_ops,
0 /* no quirks, we're perfect! */);
if (ret)
if (ret) {
kfree(ctrl);
goto out;
}

if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING))
WARN_ON_ONCE(1);
Expand Down

0 comments on commit 9a66e6b

Please sign in to comment.