Skip to content

Commit 594ec2a

Browse files
Kemeng Shiakpm00
authored andcommitted
mm: shmem: add missing shmem_unacct_size() in __shmem_file_setup()
We will miss shmem_unacct_size() when is_idmapped_mnt() returns a failure. Move is_idmapped_mnt() before shmem_acct_size() to fix the issue. Link: https://lkml.kernel.org/r/[email protected] Fixes: 7a80e5b ("shmem: support idmapped mounts for tmpfs") Signed-off-by: Kemeng Shi <[email protected]> Reviewed-by: Baolin Wang <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Kairui Song <[email protected]> Cc: kernel test robot <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent e08d5f5 commit 594ec2a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mm/shmem.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5812,12 +5812,12 @@ static struct file *__shmem_file_setup(struct vfsmount *mnt, const char *name,
58125812
if (size < 0 || size > MAX_LFS_FILESIZE)
58135813
return ERR_PTR(-EINVAL);
58145814

5815-
if (shmem_acct_size(flags, size))
5816-
return ERR_PTR(-ENOMEM);
5817-
58185815
if (is_idmapped_mnt(mnt))
58195816
return ERR_PTR(-EINVAL);
58205817

5818+
if (shmem_acct_size(flags, size))
5819+
return ERR_PTR(-ENOMEM);
5820+
58215821
inode = shmem_get_inode(&nop_mnt_idmap, mnt->mnt_sb, NULL,
58225822
S_IFREG | S_IRWXUGO, 0, flags);
58235823
if (IS_ERR(inode)) {

0 commit comments

Comments
 (0)