Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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/20250516170939.965736-3-shikemeng@huaweicloud.com
Fixes: 7a80e5b8c6fa ("shmem: support idmapped mounts for tmpfs")
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Kairui Song <kasong@tencent.com>
Cc: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Kemeng Shi and committed by
Andrew Morton
594ec2ab e08d5f51

+3 -3
+3 -3
mm/shmem.c
··· 5812 5812 if (size < 0 || size > MAX_LFS_FILESIZE) 5813 5813 return ERR_PTR(-EINVAL); 5814 5814 5815 - if (shmem_acct_size(flags, size)) 5816 - return ERR_PTR(-ENOMEM); 5817 - 5818 5815 if (is_idmapped_mnt(mnt)) 5819 5816 return ERR_PTR(-EINVAL); 5817 + 5818 + if (shmem_acct_size(flags, size)) 5819 + return ERR_PTR(-ENOMEM); 5820 5820 5821 5821 inode = shmem_get_inode(&nop_mnt_idmap, mnt->mnt_sb, NULL, 5822 5822 S_IFREG | S_IRWXUGO, 0, flags);