Skip to content

Commit a989fde

Browse files
committed
Merge tag 'libnvdimm-fixes-7.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm fix from Ira Weiny: - Fix old potential use after free bug * tag 'libnvdimm-fixes-7.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: nvdimm/bus: Fix potential use after free in asynchronous initialization
2 parents 9e22d8e + a8aec14 commit a989fde

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/nvdimm/bus.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,14 +486,15 @@ EXPORT_SYMBOL_GPL(nd_synchronize);
486486
static void nd_async_device_register(void *d, async_cookie_t cookie)
487487
{
488488
struct device *dev = d;
489+
struct device *parent = dev->parent;
489490

490491
if (device_add(dev) != 0) {
491492
dev_err(dev, "%s: failed\n", __func__);
492493
put_device(dev);
493494
}
494495
put_device(dev);
495-
if (dev->parent)
496-
put_device(dev->parent);
496+
if (parent)
497+
put_device(parent);
497498
}
498499

499500
static void nd_async_device_unregister(void *d, async_cookie_t cookie)

0 commit comments

Comments
 (0)