From: Christoph Hellwig Date: Sat, 21 Jan 2023 07:10:42 +0000 (+0100) Subject: mm: reject vmap with VM_FLUSH_RESET_PERMS X-Git-Tag: microblaze-v6.6~1071^2~189 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=37f3605e5e7af7de12aeb670c5b94e5a3c8dbf74;p=linux-2.6-microblaze.git mm: reject vmap with VM_FLUSH_RESET_PERMS Patch series "cleanup vfree and vunmap". This little series untangles the vfree and vunmap code path a bit. This patch (of 10): VM_FLUSH_RESET_PERMS is just for use with vmalloc as it is tied to freeing the underlying pages. Link: https://lkml.kernel.org/r/20230121071051.1143058-1-hch@lst.de Link: https://lkml.kernel.org/r/20230121071051.1143058-2-hch@lst.de Signed-off-by: Christoph Hellwig Reviewed-by: Uladzislau Rezki (Sony) Reviewed-by: David Hildenbrand Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Vincenzo Frascino Signed-off-by: Andrew Morton --- diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 428e0bee5c9c..3f3cb4875966 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2868,6 +2868,9 @@ void *vmap(struct page **pages, unsigned int count, might_sleep(); + if (WARN_ON_ONCE(flags & VM_FLUSH_RESET_PERMS)) + return NULL; + /* * Your top guard is someone else's bottom guard. Not having a top * guard compromises someone else's mappings too.