Re: [PATCH 6.1.y] selinux: avoid dereference of garbage after mount failure

Greg KH
2025-05-20T11:18:40Z

On Mon, May 12, 2025 at 09:44:00AM +0800, jianqi.ren.cn@windriver.com wrote:
> From: Christian Göttsche <cgzones@googlemail.com>
>
> 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: Jianqi Ren <jianqi.ren.cn@windriver.com>
> Signed-off-by: He Zhe <zhe.he@windriver.com>
> ---
> Verified the build test

No you did not :(