mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 5.4 13/15] nvme-rdma: fix possible use-after-free in transport error_recovery work
Date: Wed,  9 Feb 2022 13:42:59 -0500	[thread overview]
Message-ID: <20220209184305.47983-13-sashal@kernel.org> (raw)
In-Reply-To: <20220209184305.47983-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 08a23bb4b8b57..4213c71b02a4b 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1110,6 +1110,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


  parent reply	other threads:[~2022-02-09 18:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 18:42 [PATCH AUTOSEL 5.4 01/15] platform/x86: ISST: Fix possible circular locking dependency detected Sasha Levin
2022-02-09 18:42 ` [PATCH AUTOSEL 5.4 02/15] selftests: rtc: Increase test timeout so that all tests run Sasha Levin
2022-02-09 18:42 ` [PATCH AUTOSEL 5.4 03/15] net: ieee802154: at86rf230: Stop leaking skb's Sasha Levin
2022-02-09 18:42 ` [PATCH AUTOSEL 5.4 04/15] selftests/zram: Skip max_comp_streams interface on newer kernel Sasha Levin
2022-02-09 18:42 ` [PATCH AUTOSEL 5.4 05/15] selftests/zram01.sh: Fix compression ratio calculation Sasha Levin
2022-02-09 18:42 ` [PATCH AUTOSEL 5.4 06/15] selftests/zram: Adapt the situation that /dev/zram0 is being used Sasha Levin
2022-02-09 18:42 ` [PATCH AUTOSEL 5.4 07/15] ax25: improve the incomplete fix to avoid UAF and NPD bugs Sasha Levin
2022-02-09 18:42 ` [PATCH AUTOSEL 5.4 08/15] vfs: make freeze_super abort when sync_filesystem returns error Sasha Levin
2022-02-09 18:42 ` [PATCH AUTOSEL 5.4 09/15] quota: make dquot_quota_sync return errors from ->sync_fs Sasha Levin
2022-02-09 18:42 ` [PATCH AUTOSEL 5.4 10/15] btrfs: tree-checker: check item_size for dev_item Sasha Levin
2022-02-09 18:42 ` [PATCH AUTOSEL 5.4 11/15] nvme: fix a possible use-after-free in controller reset during load Sasha Levin
2022-02-09 18:42 ` [PATCH AUTOSEL 5.4 12/15] nvme-tcp: fix possible use-after-free in transport error_recovery work Sasha Levin
2022-02-09 18:42 ` Sasha Levin [this message]
2022-02-09 18:43 ` [PATCH AUTOSEL 5.4 14/15] drm/amdgpu: fix logic inversion in check Sasha Levin
2022-02-09 18:43 ` [PATCH AUTOSEL 5.4 15/15] 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=20220209184305.47983-13-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