summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-03-17 15:19:58 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-03-17 15:19:58 -0700
commita989fde763f4f24209e4702f50a45be572340e68 (patch)
tree13a3ed749e4be8a321aa16d006ea4fbd822cd707 /drivers
parent9e22d8e18f37059678c2f34ab3b447b8c964c6bf (diff)
parenta8aec14230322ed8f1e8042b6d656c1631d41163 (diff)
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
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nvdimm/bus.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index bd9621d3f73c..45b7d756e39a 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -486,14 +486,15 @@ EXPORT_SYMBOL_GPL(nd_synchronize);
static void nd_async_device_register(void *d, async_cookie_t cookie)
{
struct device *dev = d;
+ struct device *parent = dev->parent;
if (device_add(dev) != 0) {
dev_err(dev, "%s: failed\n", __func__);
put_device(dev);
}
put_device(dev);
- if (dev->parent)
- put_device(dev->parent);
+ if (parent)
+ put_device(parent);
}
static void nd_async_device_unregister(void *d, async_cookie_t cookie)