]> Gentwo Git Trees - linux/.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)
committerCasey Schaufler <casey@schaufler-ca.com>
Sun, 22 Jun 2025 15:51:32 +0000 (08:51 -0700)
commit69204f6cdb90f56b7ca27966d1080841108fc5de
tree684c6038214a407970a5bbaeb86f764d37ad2825
parent8e5d9f916a9678e2dcbed2289b87efd453e4e052
smack: always "instantiate" inode in smack_inode_init_security()

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>
security/smack/smack_lsm.c