From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sagi Grimberg <sagi@grimberg.me>, Sasha Levin <sashal@kernel.org>,
kbusch@kernel.org, axboe@fb.com, linux-nvme@lists.infradead.org
Subject: [PATCH AUTOSEL 4.19 09/10] nvme-rdma: fix possible use-after-free in transport error_recovery work
Date: Wed, 9 Feb 2022 13:44:08 -0500 [thread overview]
Message-ID: <20220209184410.48223-9-sashal@kernel.org> (raw)
In-Reply-To: <20220209184410.48223-1-sashal@kernel.org>
From: Sagi Grimberg <sagi@grimberg.me>
[ Upstream commit b6bb1722f34bbdbabed27acdceaf585d300c5fd2 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
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 1f41cf80f827c..55f4999525037 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1050,6 +1050,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.34.1
next prev parent reply other threads:[~2022-02-09 18:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 18:44 [PATCH AUTOSEL 4.19 01/10] net: ieee802154: at86rf230: Stop leaking skb's Sasha Levin
2022-02-09 18:44 ` [PATCH AUTOSEL 4.19 02/10] selftests/zram: Skip max_comp_streams interface on newer kernel Sasha Levin
2022-02-09 18:44 ` [PATCH AUTOSEL 4.19 03/10] selftests/zram01.sh: Fix compression ratio calculation Sasha Levin
2022-02-09 18:44 ` [PATCH AUTOSEL 4.19 04/10] selftests/zram: Adapt the situation that /dev/zram0 is being used Sasha Levin
2022-02-09 18:44 ` [PATCH AUTOSEL 4.19 05/10] ax25: improve the incomplete fix to avoid UAF and NPD bugs Sasha Levin
2022-02-09 18:44 ` [PATCH AUTOSEL 4.19 06/10] vfs: make freeze_super abort when sync_filesystem returns error Sasha Levin
2022-02-09 18:44 ` [PATCH AUTOSEL 4.19 07/10] quota: make dquot_quota_sync return errors from ->sync_fs Sasha Levin
2022-02-09 18:44 ` [PATCH AUTOSEL 4.19 08/10] nvme: fix a possible use-after-free in controller reset during load Sasha Levin
2022-02-09 18:44 ` Sasha Levin [this message]
2022-02-09 18:44 ` [PATCH AUTOSEL 4.19 10/10] Revert "module, async: async_synchronize_full() on module init iff async is used" Sasha Levin
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=20220209184410.48223-9-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=axboe@fb.com \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--cc=stable@vger.kernel.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
Powered by JetHome