]> git.baikalelectronics.ru Git - 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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:23:05 +0000 (14:23 +0200)
commitb82332f2dae79f7e670544c816f0bd9d0905fa7b
tree8f5bd6bc8b5da8eb3e35212277a13ef08c949e34
parent7c436df013155f34bc473c6fc2e81b6f541fa6fa
selinux: Fix selinux_sb_mnt_opts_compat()

[ Upstream commit e245610944fbed0f31726102107f21e8b6b7c57d ]

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: b74495364134 ("selinux: fix sleeping function called from invalid context")
Fixes: 97417fc8bc8f ("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