diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-26 15:24:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-26 15:24:47 -0500 |
commit | 30e2b7cfc54c1efa0aa4c75eb8aa19318e3932e3 (patch) | |
tree | 5ab19d0fcbe00a2d2ce1143818764d20411fe8e6 | |
parent | fc13ca191ee2ae5f379e2933cdff523c3b4fffc9 (diff) | |
parent | 4cb19355ea19995941ccaad115dbfac6b75215ca (diff) |
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
-rw-r--r-- | drivers/dax/dax.c | 4 | ||||
-rw-r--r-- | drivers/dax/pmem.c | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c index 0e499bfca41c..3d94ff20fdca 100644 --- a/drivers/dax/dax.c +++ b/drivers/dax/dax.c | |||
@@ -270,8 +270,8 @@ static int check_vma(struct dax_dev *dax_dev, struct vm_area_struct *vma, | |||
270 | if (!dax_dev->alive) | 270 | if (!dax_dev->alive) |
271 | return -ENXIO; | 271 | return -ENXIO; |
272 | 272 | ||
273 | /* prevent private / writable mappings from being established */ | 273 | /* prevent private mappings from being established */ |
274 | if ((vma->vm_flags & (VM_NORESERVE|VM_SHARED|VM_WRITE)) == VM_WRITE) { | 274 | if ((vma->vm_flags & VM_SHARED) != VM_SHARED) { |
275 | dev_info(dev, "%s: %s: fail, attempted private mapping\n", | 275 | dev_info(dev, "%s: %s: fail, attempted private mapping\n", |
276 | current->comm, func); | 276 | current->comm, func); |
277 | return -EINVAL; | 277 | return -EINVAL; |
diff --git a/drivers/dax/pmem.c b/drivers/dax/pmem.c index 4a15fa5df98b..73c6ce93a0d9 100644 --- a/drivers/dax/pmem.c +++ b/drivers/dax/pmem.c | |||
@@ -78,7 +78,9 @@ static int dax_pmem_probe(struct device *dev) | |||
78 | nsio = to_nd_namespace_io(&ndns->dev); | 78 | nsio = to_nd_namespace_io(&ndns->dev); |
79 | 79 | ||
80 | /* parse the 'pfn' info block via ->rw_bytes */ | 80 | /* 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; | ||
82 | altmap = nvdimm_setup_pfn(nd_pfn, &res, &__altmap); | 84 | altmap = nvdimm_setup_pfn(nd_pfn, &res, &__altmap); |
83 | if (IS_ERR(altmap)) | 85 | if (IS_ERR(altmap)) |
84 | return PTR_ERR(altmap); | 86 | return PTR_ERR(altmap); |