]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
smack: always "instantiate" inode in smack_inode_init_security()
authorKonstantin Andreev <andreev@swemel.ru>
Mon, 16 Jun 2025 01:07:31 +0000 (04:07 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:02:25 +0000 (14:02 +0100)
commitf1dbb370eca563582f90744618e6eaa95335fde6
treeabd95fc66f80e1f25a91809a408c8c093c50f7ba
parent3c4f1ca5bd912d08d33415bf537f99adeb1a9708
smack: always "instantiate" inode in smack_inode_init_security()

[ Upstream commit 69204f6cdb90f56b7ca27966d1080841108fc5de ]

If memory allocation for the SMACK64TRANSMUTE
xattr value fails in smack_inode_init_security(),
the SMK_INODE_INSTANT flag is not set in
(struct inode_smack *issp)->smk_flags,
leaving the inode as not "instantiated".

It does not matter if fs frees the inode
after failed smack_inode_init_security() call,
but there is no guarantee for this.

To be safe, mark the inode as "instantiated",
even if allocation of xattr values fails.

Signed-off-by: Konstantin Andreev <andreev@swemel.ru>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Stable-dep-of: 78fc6a94be25 ("smack: fix bug: invalid label of unix socket file")
Signed-off-by: Sasha Levin <sashal@kernel.org>
security/smack/smack_lsm.c