[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+CK2bBX6L2or4RRhKoinAOh6BpCv2mskx7MPQz-2EdCgdMW6Q@mail.gmail.com>
Date: Thu, 22 Jan 2026 13:00:33 -0500
From: Pasha Tatashin <pasha.tatashin@...een.com>
To: Pratyush Yadav <pratyush@...nel.org>
Cc: Hugh Dickins <hughd@...gle.com>, Baolin Wang <baolin.wang@...ux.alibaba.com>,
Andrew Morton <akpm@...ux-foundation.org>, Mike Rapoport <rppt@...nel.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] memfd: export alloc_file()
> ---
> include/linux/memfd.h | 6 ++++++
> mm/memfd.c | 4 ++--
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/memfd.h b/include/linux/memfd.h
> index cc74de3dbcfe..c328a7b356d0 100644
> --- a/include/linux/memfd.h
> +++ b/include/linux/memfd.h
> @@ -17,6 +17,7 @@ struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx);
> * to by vm_flags_ptr.
> */
> int memfd_check_seals_mmap(struct file *file, vm_flags_t *vm_flags_ptr);
> +struct file *memfd_alloc_file(const char *name, unsigned int flags);
> #else
> static inline long memfd_fcntl(struct file *f, unsigned int c, unsigned int a)
> {
> @@ -31,6 +32,11 @@ static inline int memfd_check_seals_mmap(struct file *file,
> {
> return 0;
> }
> +
> +static inline struct file *memfd_alloc_file(const char *name, unsigned int flags)
> +{
> + return ERR_PTR(-EINVAL);
> +}
> #endif
>
> #endif /* __LINUX_MEMFD_H */
> diff --git a/mm/memfd.c b/mm/memfd.c
> index ab5312aff14b..f032c6052926 100644
> --- a/mm/memfd.c
> +++ b/mm/memfd.c
> @@ -456,7 +456,7 @@ static char *alloc_name(const char __user *uname)
> return ERR_PTR(error);
> }
>
> -static struct file *alloc_file(const char *name, unsigned int flags)
> +struct file *memfd_alloc_file(const char *name, unsigned int flags)
> {
> unsigned int *file_seals;
> struct file *file;
> @@ -520,5 +520,5 @@ SYSCALL_DEFINE2(memfd_create,
> return PTR_ERR(name);
>
> fd_flags = (flags & MFD_CLOEXEC) ? O_CLOEXEC : 0;
> - return FD_ADD(fd_flags, alloc_file(name, flags));
> + return FD_ADD(fd_flags, memfd_alloc_file(name, flags));
> }
Reviewed-by: Pasha Tatashin <pasha.tatashin@...een.com>
Powered by blists - more mailing lists