From: Sagi Grimberg <sagi@grimberg.me>
To: linux-nvme@lists.infradead.org, Christoph Hellwig <hch@lst.de>,
Keith Busch <kbusch@kernel.org>
Cc: Chris Leech <cleech@redhat.com>
Subject: [PATCH v2 3/3] nvme-rdma: fix possible use-after-free in transport error_recovery work
Date: Tue, 1 Feb 2022 14:54:21 +0200 [thread overview]
Message-ID: <20220201125421.177942-4-sagi@grimberg.me> (raw)
In-Reply-To: <20220201125421.177942-1-sagi@grimberg.me>
While nvme_rdma_submit_async_event_work is checking the ctrl and queue
state before preparing the AER command and scheduling io_work, in order
to fully prevent a race where this check is not reliable the error
recovery work must flush async_event_work before continuing to destroy
the admin queue after setting the ctrl state to RESETTING such that
there is no race .submit_async_event and the error recovery handler
itself changing the ctrl state.
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
drivers/nvme/host/rdma.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 850f84d204d0..9c55e4be8a39 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1200,6 +1200,7 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work)
struct nvme_rdma_ctrl, err_work);
nvme_stop_keep_alive(&ctrl->ctrl);
+ flush_work(&ctrl->ctrl.async_event_work);
nvme_rdma_teardown_io_queues(ctrl, false);
nvme_start_queues(&ctrl->ctrl);
nvme_rdma_teardown_admin_queue(ctrl, false);
--
2.30.2
next prev parent reply other threads:[~2022-02-01 12:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-01 12:54 [PATCH v2 0/3] nvme-[tcp|rdma] fix for possible use-after-free Sagi Grimberg
2022-02-01 12:54 ` [PATCH v2 1/3] nvme: fix a possible use-after-free in controller reset during load Sagi Grimberg
2022-02-03 14:43 ` Max Gurtovoy
2022-02-03 15:03 ` Sagi Grimberg
2022-02-03 15:47 ` Max Gurtovoy
2022-02-04 12:20 ` Hannes Reinecke
2022-02-01 12:54 ` [PATCH v2 2/3] nvme-tcp: fix possible use-after-free in transport error_recovery work Sagi Grimberg
2022-02-04 12:20 ` Hannes Reinecke
2022-02-01 12:54 ` Sagi Grimberg [this message]
2022-02-04 12:21 ` [PATCH v2 3/3] nvme-rdma: " Hannes Reinecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220201125421.177942-4-sagi@grimberg.me \
--to=sagi@grimberg.me \
--cc=cleech@redhat.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).