ramfs: Initialize security of in-memory inodes
authorRoberto Sassu <roberto.sassu@huawei.com>
Thu, 16 Nov 2023 09:01:25 +0000 (10:01 +0100)
committerCasey Schaufler <casey@schaufler-ca.com>
Fri, 26 Jan 2024 17:08:16 +0000 (09:08 -0800)
commitf0816d4332c3f764cd42cf8124a193e17eeccba9
tree76ed8ca1802e9bf69d6a57a4c94bf83f103fc107
parente63d86b8b76437815fc040e8e65da257c28ba922
ramfs: Initialize security of in-memory inodes

Add a call security_inode_init_security() after ramfs_get_inode(), to let
LSMs initialize the inode security field. Skip ramfs_fill_super(), as the
initialization is done through the sb_set_mnt_opts hook.

Calling security_inode_init_security() call inside ramfs_get_inode() is
not possible since, for CONFIG_SHMEM=n, tmpfs also calls the former after
the latter.

Pass NULL as initxattrs() callback to security_inode_init_security(), since
the purpose of the call is only to initialize the in-memory inodes.

Cc: Hugh Dickins <hughd@google.com>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
fs/ramfs/inode.c