All of lore.kernel.org
 help / color / mirror / Atom feed
From: Casey Chen <cachen@purestorage.com>
To: linux-nvme@lists.infradead.org
Cc: yzhong@purestorage.com, ashishk@purestorage.com,
	Casey Chen <cachen@purestorage.com>
Subject: [PATCHv2 2/2] nvme-pci: Fix UAF introduced by nvme_dev_remove_admin()
Date: Wed,  7 Jul 2021 14:14:32 -0700	[thread overview]
Message-ID: <20210707211432.29536-3-cachen@purestorage.com> (raw)
In-Reply-To: <20210707211432.29536-1-cachen@purestorage.com>

nvme_dev_remove_admin() could free admin_q and admin_tagset while
they are being accessed by nvme_dev_disable(), which could come from
nvme_remove_dead_ctrl() by nvme_reset_work() during cleanup.

Commit cb4bfda62afa ("nvme-pci: fix hot removal during error handling")
was to avoid requests being stuck on a removed controller by killing
admin queue. But the later fix c8e9e9b7646e ("nvme-pci: unquiesce
admin queue on shutdown"), together with nvme_dev_disable(dev, true)
right before nvme_dev_remove_admin() could help dispatch requests and
fail them early, so we don't need nvme_dev_remove_admin() any more.

Fixes: cb4bfda62afa ("nvme-pci: fix hot removal during error handling")

Signed-off-by: Casey Chen <cachen@purestorage.com>
---
 drivers/nvme/host/pci.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index f98dca6a4d32..d07634e28da7 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3048,7 +3048,6 @@ static void nvme_remove(struct pci_dev *pdev)
 	if (!pci_device_is_present(pdev)) {
 		nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DEAD);
 		nvme_dev_disable(dev, true);
-		nvme_dev_remove_admin(dev);
 	}
 
 	flush_work(&dev->ctrl.reset_work);
-- 
2.17.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  parent reply	other threads:[~2021-07-07 21:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 21:14 [PATCHv2 0/2] rr: nvme-pci: fix races and UAF Casey Chen
2021-07-07 21:14 ` [PATCHv2 1/2] nvme-pci: Fix multiple races in nvme_setup_io_queues() Casey Chen
2021-07-07 21:14 ` Casey Chen [this message]
2021-07-08 19:44 ` [PATCHv2 0/2] rr: nvme-pci: fix races and UAF Keith Busch
2021-07-15 23:35   ` Casey Chen
     [not found]     ` <CAOSXXT5TM_OXgMZMnprH2rzgw7vX4wNK=4O5S_2_pgKcbt0Gew@mail.gmail.com>
2021-07-16  1:21       ` Casey Chen

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=20210707211432.29536-3-cachen@purestorage.com \
    --to=cachen@purestorage.com \
    --cc=ashishk@purestorage.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=yzhong@purestorage.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.