From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: Pratyush Yadav <pratyush@kernel.org>
Cc: Hugh Dickins <hughd@google.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Andrew Morton <akpm@linux-foundation.org>,
Mike Rapoport <rppt@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] memfd: export alloc_file()
Date: Thu, 22 Jan 2026 13:00:33 -0500 [thread overview]
Message-ID: <CA+CK2bBX6L2or4RRhKoinAOh6BpCv2mskx7MPQz-2EdCgdMW6Q@mail.gmail.com> (raw)
In-Reply-To: <20260122151842.4069702-2-pratyush@kernel.org>
> ---
> 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@soleen.com>
next prev parent reply other threads:[~2026-01-22 18:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 15:18 [PATCH 0/3] mm: memfd_luo hotfixes Pratyush Yadav
2026-01-22 15:18 ` [PATCH 1/3] memfd: export alloc_file() Pratyush Yadav
2026-01-22 15:44 ` Mike Rapoport
2026-01-22 18:00 ` Pasha Tatashin [this message]
2026-01-22 15:18 ` [PATCH 2/3] mm: memfd_luo: use memfd_alloc_file() instead of shmem_file_setup() Pratyush Yadav
2026-01-22 15:45 ` Mike Rapoport
2026-01-22 18:01 ` Pasha Tatashin
2026-01-22 15:18 ` [PATCH 3/3] mm: memfd_luo: restore and free memfd_luo_ser on failure Pratyush Yadav
2026-01-22 15:46 ` Mike Rapoport
2026-01-22 18:03 ` Pasha Tatashin
2026-01-22 15:31 ` [PATCH 0/3] mm: memfd_luo hotfixes Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+CK2bBX6L2or4RRhKoinAOh6BpCv2mskx7MPQz-2EdCgdMW6Q@mail.gmail.com \
--to=pasha.tatashin@soleen.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pratyush@kernel.org \
--cc=rppt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox