]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
selinux: Fix selinux_sb_mnt_opts_compat()
authorScott Mayhew <smayhew@redhat.com>
Mon, 31 Jan 2022 18:57:36 +0000 (13:57 -0500)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 27 Apr 2022 09:56:53 +0000 (11:56 +0200)
commit7116499e3f3264c2dd8251c611c7bf779beffa30
tree9a9b438602e2a27dce7781d514abd1f6c15ff871
parentaba96aef20d12cb81009672c71aaa00f537a1ebd
selinux: Fix selinux_sb_mnt_opts_compat()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit b8b87fd954b4b1bdd2d739c8f50bf685351a1a94 ]

selinux_sb_mnt_opts_compat() is called under the sb_lock spinlock and
shouldn't be performing any memory allocations.  Fix this by parsing the
sids at the same time we're chopping up the security mount options
string and then using the pre-parsed sids when doing the comparison.

Fixes: cc274ae7763d ("selinux: fix sleeping function called from invalid context")
Fixes: 69c4a42d72eb ("lsm,selinux: add new hook to compare new mount to an existing mount")
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 486d4c18f207eef95459f3258238eab418c3c4e9)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
security/selinux/hooks.c