lkml.org 
[lkml]   [2017]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] nvme: pci: Fix NULL dereference when resetting NVMe SSD
On Mon, May 22, 2017 at 06:38:29PM +0300, Rakesh Pandit wrote:
> Just got to use the using the test box again and you are right that
> nvme_remove_dead_ctrl_work is getting called just before the NULL
> pointer dereference.
>
> Here call trace to nvme_timeout which results in eventually call to
> nvme_reset when it wants to reset the controller (which races with
> ->reset_notify from PCI layer):

Does the patch below fix the issue for you?

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b01bd5bba8e6..f8c15e2719c4 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;

+ device_lock(&dev->dev);
pci_dev_save_and_disable(dev);

- rc = pci_dev_reset(dev, 0);
+ rc = __pci_dev_reset(dev, 0);

pci_dev_restore(dev);
+ device_unlock(&dev->dev);

return rc;
}
\
 
 \ /
  Last update: 2017-05-22 18:04    [W:0.102 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site