]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
libnvdimm, pfn: Fix over-trim in trim_pfn_device()
authorWei Yang <richardw.yang@linux.intel.com>
Tue, 22 Jan 2019 02:48:09 +0000 (10:48 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1837952
commit f101ada7da6551127d192c2f1742c1e9e0f62799 upstream.

When trying to see whether current nd_region intersects with others,
trim_pfn_device() has already calculated the *size* to be expanded to
SECTION size.

Do not double append 'adjust' to 'size' when calculating whether the end
of a region collides with the next pmem region.

Fixes: ae86cbfef381 "libnvdimm, pfn: Pad pfn namespaces relative to other regions"
Cc: <stable@vger.kernel.org>
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/nvdimm/pfn_devs.c

index 6d38191ff0daaf1a5f26ec0f1cda14c9d4641a64..c657a9871483874a844f1889408b0ec134eb3b81 100644 (file)
@@ -618,7 +618,7 @@ static void trim_pfn_device(struct nd_pfn *nd_pfn, u32 *start_pad, u32 *end_trun
        if (region_intersects(start, size, IORESOURCE_SYSTEM_RAM,
                                IORES_DESC_NONE) == REGION_MIXED
                        || !IS_ALIGNED(end, nd_pfn->align)
-                       || nd_region_conflict(nd_region, start, size + adjust))
+                       || nd_region_conflict(nd_region, start, size))
                *end_trunc = end - phys_pmem_align_down(nd_pfn, end);
 }