Skip to content
Commit 04409b63 authored by Christian Göttsche's avatar Christian Göttsche Committed by felix
Browse files

selinux: avoid dereference of garbage after mount failure

stable inclusion
from stable-v6.6.26
commit 477ed6789eb9f3f4d3568bb977f90c863c12724e
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9QG73
CVE: CVE-2024-35904

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=477ed6789eb9f3f4d3568bb977f90c863c12724e



--------------------------------

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: 0619f0f5 ("selinux: wrap selinuxfs state")
Signed-off-by: default avatarChristian Göttsche <cgzones@googlemail.com>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

Conflicts:
    security/selinux/selinuxfs.c
[selinuxfs_mount still in use because of SECURITY_SELINUX_DISABLE,
so we reserve it, only deal with kern_mount failure issue]
Signed-off-by: default avatarFelix Fu <fuzhen5@huawei.com>
parent 5bab8a92
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment