Skip to content

Commit 30e2b7c

Browse files
committed
Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm fixes from Dan Williams: - Fix a crash that occurs at driver initialization if the memory region is already busy (request_mem_region() fails). - Fix a vma validation check that mistakenly allows a private device- dax mapping to be established. Device-dax explicitly forbids private mappings so it can guarantee a given fault granularity and backing memory type. Both of these fixes have soaked in -next and are tagged for -stable. * 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: device-dax: fail all private mapping attempts device-dax: check devm_nsio_enable() return value
2 parents fc13ca1 + 4cb1935 commit 30e2b7c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

drivers/dax/dax.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ static int check_vma(struct dax_dev *dax_dev, struct vm_area_struct *vma,
270270
if (!dax_dev->alive)
271271
return -ENXIO;
272272

273-
/* prevent private / writable mappings from being established */
274-
if ((vma->vm_flags & (VM_NORESERVE|VM_SHARED|VM_WRITE)) == VM_WRITE) {
273+
/* prevent private mappings from being established */
274+
if ((vma->vm_flags & VM_SHARED) != VM_SHARED) {
275275
dev_info(dev, "%s: %s: fail, attempted private mapping\n",
276276
current->comm, func);
277277
return -EINVAL;

drivers/dax/pmem.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ static int dax_pmem_probe(struct device *dev)
7878
nsio = to_nd_namespace_io(&ndns->dev);
7979

8080
/* parse the 'pfn' info block via ->rw_bytes */
81-
devm_nsio_enable(dev, nsio);
81+
rc = devm_nsio_enable(dev, nsio);
82+
if (rc)
83+
return rc;
8284
altmap = nvdimm_setup_pfn(nd_pfn, &res, &__altmap);
8385
if (IS_ERR(altmap))
8486
return PTR_ERR(altmap);

0 commit comments

Comments
 (0)