selinux: check return value of sel_make_avc_files
authorChristian Göttsche <cgzones@googlemail.com>
Tue, 25 Jan 2022 14:14:20 +0000 (15:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:39:59 +0000 (14:39 +0200)
commit962d1f59d5f7e777a47d1691251242d2ab46ef5e
treedf1bc41786dda326c93958817fe8ac722096d6f2
parent1ae9b020ddfcec9c8864774c08af98b8cd20a210
selinux: check return value of sel_make_avc_files

[ Upstream commit bcb62828e3e8c813b6613db6eb7fd9657db248fc ]

sel_make_avc_files() might fail and return a negative errno value on
memory allocation failures. Re-add the check of the return value,
dropped in 66f8e2f03c02 ("selinux: sidtab reverse lookup hash table").

Reported by clang-analyzer:

    security/selinux/selinuxfs.c:2129:2: warning: Value stored to
      'ret' is never read [deadcode.DeadStores]
            ret = sel_make_avc_files(dentry);
            ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 66f8e2f03c02 ("selinux: sidtab reverse lookup hash table")
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
[PM: description line wrapping, added proper commit ref]
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
security/selinux/selinuxfs.c