From: Christoph Hellwig <hch@lst.de>
To: helgaas@kernel.org
Cc: rakesh@tuxera.com, linux-pci@vger.kernel.org,
linux-nvme@lists.infradead.org
Subject: [PATCH] PCI: ensure the PCI device is locked over ->reset_notify calls
Date: Tue, 23 May 2017 07:42:02 +0200 [thread overview]
Message-ID: <20170523054202.7985-2-hch@lst.de> (raw)
In-Reply-To: <20170523054202.7985-1-hch@lst.de>
Without this ->notify_reset instance may race with ->remove calls,
which can be easily triggered in NVMe.
Reported-by: Rakesh Pandit <rakesh@tuxera.com>
Tested-by: Rakesh Pandit <rakesh@tuxera.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/pci/pci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b01bd5bba8e6..b61ad77dc322 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4275,11 +4275,13 @@ int pci_reset_function(struct pci_dev *dev)
if (rc)
return rc;
+ pci_dev_lock(dev);
pci_dev_save_and_disable(dev);
- rc = pci_dev_reset(dev, 0);
+ rc = __pci_dev_reset(dev, 0);
pci_dev_restore(dev);
+ pci_dev_unlock(dev);
return rc;
}
--
2.11.0
next prev parent reply other threads:[~2017-05-23 5:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-23 5:42 avoid null pointer rereference during FLR Christoph Hellwig
2017-05-23 5:42 ` Christoph Hellwig [this message]
2017-05-29 9:19 ` [PATCH] PCI: ensure the PCI device is locked over ->reset_notify calls Rakesh Pandit
2017-05-30 22:28 ` Bjorn Helgaas
2017-05-31 4:58 ` Christoph Hellwig
2017-05-31 16:51 ` Bjorn Helgaas
2017-06-01 10:46 ` Christoph Hellwig
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=20170523054202.7985-2-hch@lst.de \
--to=hch@lst.de \
--cc=helgaas@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=rakesh@tuxera.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 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).