summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-09-06 10:40:13 +0100
committerMark Brown <broonie@kernel.org>2018-09-06 10:40:13 +0100
commit82eacc8a7bb8eb5809ef9ad8fae8104110626305 (patch)
treed507c4402d79f6b6e7841ae9a15612307cb0f049 /mm
parent3a9cbd70c74f3a4afc78f898f7f95519ef5c5477 (diff)
parent4d9339a1f0e6e288903d34020f2378d250ea3cac (diff)
Merge tag 'v4.4.154' into linux-linaro-lsk-v4.4
This is the 4.4.154 stable release
Diffstat (limited to 'mm')
-rw-r--r--mm/memory.c3
-rw-r--r--mm/zswap.c9
2 files changed, 12 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c
index d5bb1465d30c..42db644f5ec4 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3701,6 +3701,9 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
return -EINVAL;
maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot);
+ if (!maddr)
+ return -ENOMEM;
+
if (write)
memcpy_toio(maddr + offset, buf, len);
else
diff --git a/mm/zswap.c b/mm/zswap.c
index 568015e2fe7a..87a8491909ee 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1018,6 +1018,15 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset,
ret = -ENOMEM;
goto reject;
}
+
+ /* A second zswap_is_full() check after
+ * zswap_shrink() to make sure it's now
+ * under the max_pool_percent
+ */
+ if (zswap_is_full()) {
+ ret = -ENOMEM;
+ goto reject;
+ }
}
/* allocate entry */