summaryrefslogtreecommitdiff
path: root/mm/shmem.c
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2020-02-01 13:47:17 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2020-02-01 13:47:17 +0300
commit4c25df5640ae6e4491ee2c50d3f70c1559ef037d (patch)
tree9d68b0361918926d7d7b6d78090dcfb942ec4e72 /mm/shmem.c
parent34b5a946a9543ce38d8ad1aacc4362533a813db7 (diff)
parent3d7dfd632f9b60cfce069b4da517e6b1a1c3f613 (diff)
downloadlinux-4c25df5640ae6e4491ee2c50d3f70c1559ef037d.tar.xz
Merge branch 'topic/user-access-begin' into next
Merge the user_access_begin() series from Christophe. This is based on a commit from Linus that went into v5.5-rc7.
Diffstat (limited to 'mm/shmem.c')
-rw-r--r--mm/shmem.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 165fa6332993..8793e8cc1a48 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2107,9 +2107,10 @@ unsigned long shmem_get_unmapped_area(struct file *file,
/*
* Our priority is to support MAP_SHARED mapped hugely;
* and support MAP_PRIVATE mapped hugely too, until it is COWed.
- * But if caller specified an address hint, respect that as before.
+ * But if caller specified an address hint and we allocated area there
+ * successfully, respect that as before.
*/
- if (uaddr)
+ if (uaddr == addr)
return addr;
if (shmem_huge != SHMEM_HUGE_FORCE) {
@@ -2143,7 +2144,7 @@ unsigned long shmem_get_unmapped_area(struct file *file,
if (inflated_len < len)
return addr;
- inflated_addr = get_area(NULL, 0, inflated_len, 0, flags);
+ inflated_addr = get_area(NULL, uaddr, inflated_len, 0, flags);
if (IS_ERR_VALUE(inflated_addr))
return addr;
if (inflated_addr & ~PAGE_MASK)