]> www.infradead.org Git - users/dwmw2/linux.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 11:57:33 +0000 (13:57 +0200)
commit5cf1970ea12e62691e579c9f0f4ed926fb243e4b
treec92669385a7f41c6213f37bd608e1537bcd8470f
parentc66518f4ddcc2e1576aa6bb0a6d9f8f521e925fb
selinux: Fix selinux_sb_mnt_opts_compat()

[ 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>
security/selinux/hooks.c