summaryrefslogtreecommitdiff
path: root/drivers/nvdimm
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@linux.intel.com>2018-09-25 13:53:02 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-13 11:08:42 -0800
commit4f1a55a4f990016406147cf3e0c9487bf83e50f0 (patch)
tree4acb66d3d4b95ac9e569474497d7c92c92362252 /drivers/nvdimm
parent7a338b87b93128f6bf846c9aec27ffe0b93b0580 (diff)
downloadlinux-rpi3-4f1a55a4f990016406147cf3e0c9487bf83e50f0.tar.gz
linux-rpi3-4f1a55a4f990016406147cf3e0c9487bf83e50f0.tar.bz2
linux-rpi3-4f1a55a4f990016406147cf3e0c9487bf83e50f0.zip
libnvdimm: Hold reference on parent while scheduling async init
commit b6eae0f61db27748606cc00dafcfd1e2c032f0a5 upstream. Unlike asynchronous initialization in the core we have not yet associated the device with the parent, and as such the device doesn't hold a reference to the parent. In order to resolve that we should be holding a reference on the parent until the asynchronous initialization has completed. Cc: <stable@vger.kernel.org> Fixes: 4d88a97aa9e8 ("libnvdimm: ...base ... infrastructure") Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/nvdimm')
-rw-r--r--drivers/nvdimm/bus.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 8aae6dcc839f..9148015ed803 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -488,6 +488,8 @@ static void nd_async_device_register(void *d, async_cookie_t cookie)
put_device(dev);
}
put_device(dev);
+ if (dev->parent)
+ put_device(dev->parent);
}
static void nd_async_device_unregister(void *d, async_cookie_t cookie)
@@ -507,6 +509,8 @@ void __nd_device_register(struct device *dev)
if (!dev)
return;
dev->bus = &nvdimm_bus_type;
+ if (dev->parent)
+ get_device(dev->parent);
get_device(dev);
async_schedule_domain(nd_async_device_register, dev,
&nd_async_domain);