]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selinux: avoid dereference of garbage after mount failure
authorChristian Göttsche <cgzones@googlemail.com>
Thu, 28 Mar 2024 19:16:58 +0000 (20:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:35:48 +0000 (16:35 +0200)
commit477ed6789eb9f3f4d3568bb977f90c863c12724e
tree228e1ed5decb2ba00ec5e5f943204e4f6ca79653
parent9e2af26c29c6c6f1215d56c3246da148e54b2357
selinux: avoid dereference of garbage after mount failure

commit 37801a36b4d68892ce807264f784d818f8d0d39b upstream.

In case kern_mount() fails and returns an error pointer return in the
error branch instead of continuing and dereferencing the error pointer.

While on it drop the never read static variable selinuxfs_mount.

Cc: stable@vger.kernel.org
Fixes: 0619f0f5e36f ("selinux: wrap selinuxfs state")
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
security/selinux/selinuxfs.c