Skip to content

Commit e3e5368

Browse files
committed
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
2 parents 957df9a + ff0ffe5 commit e3e5368

File tree

5 files changed

+10
-16
lines changed

5 files changed

+10
-16
lines changed

drivers/nvme/host/core.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,7 @@ void nvme_cleanup_cmd(struct request *req)
998998
clear_bit_unlock(0, &ctrl->discard_page_busy);
999999
else
10001000
kfree(bvec_virt(&req->special_vec));
1001+
req->rq_flags &= ~RQF_SPECIAL_PAYLOAD;
10011002
}
10021003
}
10031004
EXPORT_SYMBOL_GPL(nvme_cleanup_cmd);
@@ -3959,12 +3960,13 @@ static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl,
39593960

39603961
mutex_lock(&ctrl->namespaces_lock);
39613962
list_for_each_entry_safe(ns, next, &ctrl->namespaces, list) {
3962-
if (ns->head->ns_id > nsid)
3963-
list_splice_init_rcu(&ns->list, &rm_list,
3964-
synchronize_rcu);
3963+
if (ns->head->ns_id > nsid) {
3964+
list_del_rcu(&ns->list);
3965+
synchronize_srcu(&ctrl->srcu);
3966+
list_add_tail_rcu(&ns->list, &rm_list);
3967+
}
39653968
}
39663969
mutex_unlock(&ctrl->namespaces_lock);
3967-
synchronize_srcu(&ctrl->srcu);
39683970

39693971
list_for_each_entry_safe(ns, next, &rm_list, list)
39703972
nvme_ns_remove(ns);

drivers/nvme/target/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,7 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
957957
req->metadata_sg_cnt = 0;
958958
req->transfer_len = 0;
959959
req->metadata_len = 0;
960+
req->cqe->result.u64 = 0;
960961
req->cqe->status = 0;
961962
req->cqe->sq_head = 0;
962963
req->ns = NULL;

drivers/nvme/target/fabrics-cmd-auth.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ void nvmet_execute_auth_send(struct nvmet_req *req)
333333
pr_debug("%s: ctrl %d qid %d nvme status %x error loc %d\n",
334334
__func__, ctrl->cntlid, req->sq->qid,
335335
status, req->error_loc);
336-
req->cqe->result.u64 = 0;
337336
if (req->sq->dhchap_step != NVME_AUTH_DHCHAP_MESSAGE_SUCCESS2 &&
338337
req->sq->dhchap_step != NVME_AUTH_DHCHAP_MESSAGE_FAILURE2) {
339338
unsigned long auth_expire_secs = ctrl->kato ? ctrl->kato : 120;
@@ -516,8 +515,6 @@ void nvmet_execute_auth_receive(struct nvmet_req *req)
516515
status = nvmet_copy_to_sgl(req, 0, d, al);
517516
kfree(d);
518517
done:
519-
req->cqe->result.u64 = 0;
520-
521518
if (req->sq->dhchap_step == NVME_AUTH_DHCHAP_MESSAGE_SUCCESS2)
522519
nvmet_auth_sq_free(req->sq);
523520
else if (req->sq->dhchap_step == NVME_AUTH_DHCHAP_MESSAGE_FAILURE1) {

drivers/nvme/target/fabrics-cmd.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,6 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req)
226226
if (status)
227227
goto out;
228228

229-
/* zero out initial completion result, assign values as needed */
230-
req->cqe->result.u32 = 0;
231-
232229
if (c->recfmt != 0) {
233230
pr_warn("invalid connect version (%d).\n",
234231
le16_to_cpu(c->recfmt));
@@ -305,9 +302,6 @@ static void nvmet_execute_io_connect(struct nvmet_req *req)
305302
if (status)
306303
goto out;
307304

308-
/* zero out initial completion result, assign values as needed */
309-
req->cqe->result.u32 = 0;
310-
311305
if (c->recfmt != 0) {
312306
pr_warn("invalid connect version (%d).\n",
313307
le16_to_cpu(c->recfmt));

drivers/nvme/target/passthru.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,13 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w)
226226
req->cmd->common.opcode == nvme_admin_identify) {
227227
switch (req->cmd->identify.cns) {
228228
case NVME_ID_CNS_CTRL:
229-
nvmet_passthru_override_id_ctrl(req);
229+
status = nvmet_passthru_override_id_ctrl(req);
230230
break;
231231
case NVME_ID_CNS_NS:
232-
nvmet_passthru_override_id_ns(req);
232+
status = nvmet_passthru_override_id_ns(req);
233233
break;
234234
case NVME_ID_CNS_NS_DESC_LIST:
235-
nvmet_passthru_override_id_descs(req);
235+
status = nvmet_passthru_override_id_descs(req);
236236
break;
237237
}
238238
} else if (status < 0)

0 commit comments

Comments
 (0)