Skip to content

Commit e8db8c9

Browse files
committed
Merge tag 'nvme-5.17-2022-02-03' of git://git.infradead.org/nvme into block-5.17
Pull NVMe fixes from Christoph: "nvme fixes for Linux 5.17 - fix a use-after-free in rdm and tcp controller reset (Sagi Grimberg) - fix the state check in nvmf_ctlr_matches_baseopts (Uday Shankar)" * tag 'nvme-5.17-2022-02-03' of git://git.infradead.org/nvme: nvme-fabrics: fix state check in nvmf_ctlr_matches_baseopts() nvme-rdma: fix possible use-after-free in transport error_recovery work nvme-tcp: fix possible use-after-free in transport error_recovery work nvme: fix a possible use-after-free in controller reset during load
2 parents aace2b7 + 6a51abd commit e8db8c9

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

drivers/nvme/host/core.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4253,7 +4253,14 @@ static void nvme_async_event_work(struct work_struct *work)
42534253
container_of(work, struct nvme_ctrl, async_event_work);
42544254

42554255
nvme_aen_uevent(ctrl);
4256-
ctrl->ops->submit_async_event(ctrl);
4256+
4257+
/*
4258+
* The transport drivers must guarantee AER submission here is safe by
4259+
* flushing ctrl async_event_work after changing the controller state
4260+
* from LIVE and before freeing the admin queue.
4261+
*/
4262+
if (ctrl->state == NVME_CTRL_LIVE)
4263+
ctrl->ops->submit_async_event(ctrl);
42574264
}
42584265

42594266
static bool nvme_ctrl_pp_status(struct nvme_ctrl *ctrl)

drivers/nvme/host/fabrics.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ nvmf_ctlr_matches_baseopts(struct nvme_ctrl *ctrl,
170170
struct nvmf_ctrl_options *opts)
171171
{
172172
if (ctrl->state == NVME_CTRL_DELETING ||
173+
ctrl->state == NVME_CTRL_DELETING_NOIO ||
173174
ctrl->state == NVME_CTRL_DEAD ||
174175
strcmp(opts->subsysnqn, ctrl->opts->subsysnqn) ||
175176
strcmp(opts->host->nqn, ctrl->opts->host->nqn) ||

drivers/nvme/host/rdma.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,7 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work)
12001200
struct nvme_rdma_ctrl, err_work);
12011201

12021202
nvme_stop_keep_alive(&ctrl->ctrl);
1203+
flush_work(&ctrl->ctrl.async_event_work);
12031204
nvme_rdma_teardown_io_queues(ctrl, false);
12041205
nvme_start_queues(&ctrl->ctrl);
12051206
nvme_rdma_teardown_admin_queue(ctrl, false);

drivers/nvme/host/tcp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,6 +2096,7 @@ static void nvme_tcp_error_recovery_work(struct work_struct *work)
20962096
struct nvme_ctrl *ctrl = &tcp_ctrl->ctrl;
20972097

20982098
nvme_stop_keep_alive(ctrl);
2099+
flush_work(&ctrl->async_event_work);
20992100
nvme_tcp_teardown_io_queues(ctrl, false);
21002101
/* unquiesce to fail fast pending requests */
21012102
nvme_start_queues(ctrl);

0 commit comments

Comments
 (0)