Skip to content

Commit 1812de1

Browse files
author
Al Viro
committed
secretmem: move setting O_LARGEFILE and bumping users' count to the place where we create the file
Acked-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 273a291 commit 1812de1

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

mm/secretmem.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static struct file *secretmem_file_create(unsigned long flags)
208208
}
209209

210210
file = alloc_file_pseudo(inode, secretmem_mnt, "secretmem",
211-
O_RDWR, &secretmem_fops);
211+
O_RDWR | O_LARGEFILE, &secretmem_fops);
212212
if (IS_ERR(file))
213213
goto err_free_inode;
214214

@@ -222,6 +222,8 @@ static struct file *secretmem_file_create(unsigned long flags)
222222
inode->i_mode |= S_IFREG;
223223
inode->i_size = 0;
224224

225+
atomic_inc(&secretmem_users);
226+
225227
return file;
226228

227229
err_free_inode:
@@ -255,9 +257,6 @@ SYSCALL_DEFINE1(memfd_secret, unsigned int, flags)
255257
goto err_put_fd;
256258
}
257259

258-
file->f_flags |= O_LARGEFILE;
259-
260-
atomic_inc(&secretmem_users);
261260
fd_install(fd, file);
262261
return fd;
263262

0 commit comments

Comments
 (0)