]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fuse: replace __get_free_page() with kmalloc()
authorMike Rapoport (Microsoft) <rppt@kernel.org>
Sat, 23 May 2026 17:54:24 +0000 (20:54 +0300)
committerChristian Brauner <brauner@kernel.org>
Wed, 27 May 2026 13:12:24 +0000 (15:12 +0200)
fuse_do_ioctl allocates memory for struct iov array using
__get_free_page().

kmalloc() is a better API for such use and it also provides better
scalability and more debugging possibilities.

Replace use of __get_free_page() with kmalloc().

Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Link: https://patch.msgid.link/20260523-b4-fs-v1-12-275e36a83f0e@kernel.org
Acked-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
fs/fuse/ioctl.c

index fdc175e93f74743eb4d2e5a4bc688df1c62e64c4..3614ea603913989213b7bc2f940041eda009ddb2 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/fileattr.h>
 #include <linux/fsverity.h>
 
+#include <linux/slab.h>
 #define FUSE_VERITY_ENABLE_ARG_MAX_PAGES 256
 
 static ssize_t fuse_send_ioctl(struct fuse_mount *fm, struct fuse_args *args,
@@ -252,7 +253,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
 
        err = -ENOMEM;
        ap.folios = fuse_folios_alloc(fm->fc->max_pages, GFP_KERNEL, &ap.descs);
-       iov_page = (struct iovec *) __get_free_page(GFP_KERNEL);
+       iov_page = kmalloc(PAGE_SIZE, GFP_KERNEL);
        if (!ap.folios || !iov_page)
                goto out;
 
@@ -400,7 +401,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
        }
        err = 0;
  out:
-       free_page((unsigned long) iov_page);
+       kfree(iov_page);
        while (ap.num_folios)
                folio_put(ap.folios[--ap.num_folios]);
        kfree(ap.folios);