Commit e3e53683 authored by Jens Axboe's avatar Jens Axboe

Merge tag 'nvme-6.10-2024-06-13' of git://git.infradead.org/nvme into block-6.10

Pull NVMe fixes from Keith:

"nvme fixes for Linux 6.10

 - Discard double free on error conditions (Chunguang)
 - Target Fixes (Daniel)
 - Namespace detachment regression fix (Keith)"

* tag 'nvme-6.10-2024-06-13' of git://git.infradead.org/nvme:
  nvme: fix namespace removal list
  nvmet: always initialize cqe.result
  nvmet-passthru: propagate status from id override functions
  nvme: avoid double free special payload
parents 957df9af ff0ffe5b
...@@ -998,6 +998,7 @@ void nvme_cleanup_cmd(struct request *req) ...@@ -998,6 +998,7 @@ void nvme_cleanup_cmd(struct request *req)
clear_bit_unlock(0, &ctrl->discard_page_busy); clear_bit_unlock(0, &ctrl->discard_page_busy);
else else
kfree(bvec_virt(&req->special_vec)); kfree(bvec_virt(&req->special_vec));
req->rq_flags &= ~RQF_SPECIAL_PAYLOAD;
} }
} }
EXPORT_SYMBOL_GPL(nvme_cleanup_cmd); EXPORT_SYMBOL_GPL(nvme_cleanup_cmd);
...@@ -3959,12 +3960,13 @@ static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl, ...@@ -3959,12 +3960,13 @@ static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl,
mutex_lock(&ctrl->namespaces_lock); mutex_lock(&ctrl->namespaces_lock);
list_for_each_entry_safe(ns, next, &ctrl->namespaces, list) { list_for_each_entry_safe(ns, next, &ctrl->namespaces, list) {
if (ns->head->ns_id > nsid) if (ns->head->ns_id > nsid) {
list_splice_init_rcu(&ns->list, &rm_list, list_del_rcu(&ns->list);
synchronize_rcu); synchronize_srcu(&ctrl->srcu);
list_add_tail_rcu(&ns->list, &rm_list);
}
} }
mutex_unlock(&ctrl->namespaces_lock); mutex_unlock(&ctrl->namespaces_lock);
synchronize_srcu(&ctrl->srcu);
list_for_each_entry_safe(ns, next, &rm_list, list) list_for_each_entry_safe(ns, next, &rm_list, list)
nvme_ns_remove(ns); nvme_ns_remove(ns);
......
...@@ -957,6 +957,7 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq, ...@@ -957,6 +957,7 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
req->metadata_sg_cnt = 0; req->metadata_sg_cnt = 0;
req->transfer_len = 0; req->transfer_len = 0;
req->metadata_len = 0; req->metadata_len = 0;
req->cqe->result.u64 = 0;
req->cqe->status = 0; req->cqe->status = 0;
req->cqe->sq_head = 0; req->cqe->sq_head = 0;
req->ns = NULL; req->ns = NULL;
......
...@@ -333,7 +333,6 @@ void nvmet_execute_auth_send(struct nvmet_req *req) ...@@ -333,7 +333,6 @@ void nvmet_execute_auth_send(struct nvmet_req *req)
pr_debug("%s: ctrl %d qid %d nvme status %x error loc %d\n", pr_debug("%s: ctrl %d qid %d nvme status %x error loc %d\n",
__func__, ctrl->cntlid, req->sq->qid, __func__, ctrl->cntlid, req->sq->qid,
status, req->error_loc); status, req->error_loc);
req->cqe->result.u64 = 0;
if (req->sq->dhchap_step != NVME_AUTH_DHCHAP_MESSAGE_SUCCESS2 && if (req->sq->dhchap_step != NVME_AUTH_DHCHAP_MESSAGE_SUCCESS2 &&
req->sq->dhchap_step != NVME_AUTH_DHCHAP_MESSAGE_FAILURE2) { req->sq->dhchap_step != NVME_AUTH_DHCHAP_MESSAGE_FAILURE2) {
unsigned long auth_expire_secs = ctrl->kato ? ctrl->kato : 120; unsigned long auth_expire_secs = ctrl->kato ? ctrl->kato : 120;
...@@ -516,8 +515,6 @@ void nvmet_execute_auth_receive(struct nvmet_req *req) ...@@ -516,8 +515,6 @@ void nvmet_execute_auth_receive(struct nvmet_req *req)
status = nvmet_copy_to_sgl(req, 0, d, al); status = nvmet_copy_to_sgl(req, 0, d, al);
kfree(d); kfree(d);
done: done:
req->cqe->result.u64 = 0;
if (req->sq->dhchap_step == NVME_AUTH_DHCHAP_MESSAGE_SUCCESS2) if (req->sq->dhchap_step == NVME_AUTH_DHCHAP_MESSAGE_SUCCESS2)
nvmet_auth_sq_free(req->sq); nvmet_auth_sq_free(req->sq);
else if (req->sq->dhchap_step == NVME_AUTH_DHCHAP_MESSAGE_FAILURE1) { else if (req->sq->dhchap_step == NVME_AUTH_DHCHAP_MESSAGE_FAILURE1) {
......
...@@ -226,9 +226,6 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req) ...@@ -226,9 +226,6 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req)
if (status) if (status)
goto out; goto out;
/* zero out initial completion result, assign values as needed */
req->cqe->result.u32 = 0;
if (c->recfmt != 0) { if (c->recfmt != 0) {
pr_warn("invalid connect version (%d).\n", pr_warn("invalid connect version (%d).\n",
le16_to_cpu(c->recfmt)); le16_to_cpu(c->recfmt));
...@@ -305,9 +302,6 @@ static void nvmet_execute_io_connect(struct nvmet_req *req) ...@@ -305,9 +302,6 @@ static void nvmet_execute_io_connect(struct nvmet_req *req)
if (status) if (status)
goto out; goto out;
/* zero out initial completion result, assign values as needed */
req->cqe->result.u32 = 0;
if (c->recfmt != 0) { if (c->recfmt != 0) {
pr_warn("invalid connect version (%d).\n", pr_warn("invalid connect version (%d).\n",
le16_to_cpu(c->recfmt)); le16_to_cpu(c->recfmt));
......
...@@ -226,13 +226,13 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w) ...@@ -226,13 +226,13 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w)
req->cmd->common.opcode == nvme_admin_identify) { req->cmd->common.opcode == nvme_admin_identify) {
switch (req->cmd->identify.cns) { switch (req->cmd->identify.cns) {
case NVME_ID_CNS_CTRL: case NVME_ID_CNS_CTRL:
nvmet_passthru_override_id_ctrl(req); status = nvmet_passthru_override_id_ctrl(req);
break; break;
case NVME_ID_CNS_NS: case NVME_ID_CNS_NS:
nvmet_passthru_override_id_ns(req); status = nvmet_passthru_override_id_ns(req);
break; break;
case NVME_ID_CNS_NS_DESC_LIST: case NVME_ID_CNS_NS_DESC_LIST:
nvmet_passthru_override_id_descs(req); status = nvmet_passthru_override_id_descs(req);
break; break;
} }
} else if (status < 0) } else if (status < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment