summaryrefslogtreecommitdiff
path: root/mm/secretmem.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-07-28 10:32:20 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2025-07-28 10:32:20 -0700
commit2d9c1336edc7d8f8e058822e02c0ce4d126a298e (patch)
treed72656ae8855473338573202f0107bc583824e03 /mm/secretmem.c
parent8297b790c65d17544d8298cb81a46f67348c6267 (diff)
parent93c73ab1776fc06f3bee91e249026aad2975e8bf (diff)
Merge tag 'pull-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc VFS updates from Al Viro: "VFS-related cleanups in various places (mostly of the "that really can't happen" or "there's a better way to do it" variety)" * tag 'pull-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: gpib: use file_inode() binder_ioctl_write_read(): simplify control flow a bit secretmem: move setting O_LARGEFILE and bumping users' count to the place where we create the file apparmor: file never has NULL f_path.mnt landlock: opened file never has a negative dentry
Diffstat (limited to 'mm/secretmem.c')
-rw-r--r--mm/secretmem.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/mm/secretmem.c b/mm/secretmem.c
index e042a4a0bc0c..b7c5592d6711 100644
--- a/mm/secretmem.c
+++ b/mm/secretmem.c
@@ -201,7 +201,7 @@ static struct file *secretmem_file_create(unsigned long flags)
return ERR_CAST(inode);
file = alloc_file_pseudo(inode, secretmem_mnt, "secretmem",
- O_RDWR, &secretmem_fops);
+ O_RDWR | O_LARGEFILE, &secretmem_fops);
if (IS_ERR(file))
goto err_free_inode;
@@ -215,6 +215,8 @@ static struct file *secretmem_file_create(unsigned long flags)
inode->i_mode |= S_IFREG;
inode->i_size = 0;
+ atomic_inc(&secretmem_users);
+
return file;
err_free_inode:
@@ -248,9 +250,6 @@ SYSCALL_DEFINE1(memfd_secret, unsigned int, flags)
goto err_put_fd;
}
- file->f_flags |= O_LARGEFILE;
-
- atomic_inc(&secretmem_users);
fd_install(fd, file);
return fd;