Patch "libnvdimm: fix namespace object confusion in is_uuid_busy()" has been added to the 4.4-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
libnvdimm: fix namespace object confusion in is_uuid_busy()
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
libnvdimm-fix-namespace-object-confusion-in-is_uuid_busy.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
e07ecd76d4db7bda1e9495395b2110a3fe28845aMon Sep 17 00:00:00 2001
From: Dan Williams <[email protected]>
Date: Tue, 5 Jan 2016 18:37:23 -0800
Subject: libnvdimm: fix namespace object confusion in is_uuid_busy()
From: Dan Williams <[email protected]>
commit e07ecd76d4db7bda1e9495395b2110a3fe28845a upstream.
When btt devices were re-worked to be child devices of regions this routine was overlooked. It mistakenly attempts to_nd_namespace_pmem() or to_nd_namespace_blk() conversions on btt and pfn devices. By luck to date we have happened to be hitting valid memory leading to a uuid miscompare, but a recent change to struct nd_namespace_common causes:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000001 IP: [<ffffffff814610dc>] memcmp+0xc/0x40 [..] Call Trace: [<ffffffffa0028631>] is_uuid_busy+0xc1/0x2a0 [libnvdimm] [<ffffffffa0028570>] ? to_nd_blk_region+0x50/0x50 [libnvdimm] [<ffffffff8158c9c0>] device_for_each_child+0x50/0x90
--- drivers/nvdimm/namespace_devs.c | 53 +++++++++++++++++++++++++++++++++++++ drivers/nvdimm/region_devs.c | 56 ---------------------------------------- 2 files changed, 53 insertions(+), 56 deletions(-)
drivers/nvdimm/namespace_devs.c +53 -0
@@ -77,6 +77,59 @@ static bool is_namespace_io(struct devicreturn dev ? dev->type == &namespace_io_device_type : false; } +static int is_uuid_busy (struct device *dev,void *data) +{ +u8 *uuid1 = data, *uuid2 =NULL ; + +if (is_namespace_pmem (dev)) { +struct nd_namespace_pmem *nspm =to_nd_namespace_pmem (dev); + + uuid2 = nspm->uuid; + }else if (is_namespace_blk (dev)) { +struct nd_namespace_blk *nsblk =to_nd_namespace_blk (dev); + + uuid2 = nsblk->uuid; + }else if (is_nd_btt (dev)) { +struct nd_btt *nd_btt =to_nd_btt (dev); + + uuid2 = nd_btt->uuid; + }else if (is_nd_pfn (dev)) { +struct nd_pfn *nd_pfn =to_nd_pfn (dev); + + uuid2 = nd_pfn->uuid; + } + +if (uuid2 &&memcmp (uuid1, uuid2,NSLABEL_UUID_LEN ) ==0 ) +return -EBUSY ; + +return 0 ; +} + +static int is_namespace_uuid_busy (struct device *dev,void *data) +{ +if (is_nd_pmem (dev) ||is_nd_blk (dev)) +return device_for_each_child (dev, data, is_uuid_busy); +return 0 ; +} + +/** +* nd_is_uuid_unique - verify that no other namespace has @uuid +* @dev: any device on a nvdimm_bus +* @uuid: uuid to check +*/ +bool nd_is_uuid_unique (struct device *dev,u8 *uuid) +{ +struct nvdimm_bus *nvdimm_bus =walk_to_nvdimm_bus (dev); + +if (!nvdimm_bus) +return false; +WARN_ON_ONCE (!is_nvdimm_bus_locked (&nvdimm_bus->dev)); +if (device_for_each_child (&nvdimm_bus->dev, uuid, + is_namespace_uuid_busy) !=0 ) +return false; +return true; +} +bool pmem_should_map_pages (struct device *dev) {struct nd_region *nd_region =to_nd_region (dev->parent);
drivers/nvdimm/region_devs.c +0 -56
62 lines not on this page · raw message
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/x86-uaccess-64-handle-the-caching-of-4-byte-nocache-copies-properly-in-__copy_user_nocache.patch queue-4.4/devm_memremap_release-fix-memremap-d-addr-handling.patch queue-4.4/libnvdimm-fix-namespace-object-confusion-in-is_uuid_busy.patch queue-4.4/x86-uaccess-64-make-the-__copy_user_nocache-assembly-code-more-readable.patch