]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selinux: improve error checking in sel_write_load()
authorPaul Moore <paul@paul-moore.com>
Fri, 25 Oct 2024 14:20:57 +0000 (11:20 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Nov 2024 00:52:38 +0000 (01:52 +0100)
commitfcfc61f63fbe9ce5bcc841654bf866f1f5d458e1
tree20e87744129dfade11173b4e9b5549b6479661d4
parentb7a396f76ada277d049558db648389456458af65
selinux: improve error checking in sel_write_load()

[ Upstream commit 42c773238037c90b3302bf37a57ae3b5c3f6004a ]

Move our existing input sanity checking to the top of sel_write_load()
and add a check to ensure the buffer size is non-zero.

Move a local variable initialization from the declaration to before it
is used.

Minor style adjustments.

Reported-by: Sam Sun <samsun1006219@gmail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
[cascardo: keep fsi initialization at its declaration point as it is used earlier]
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
security/selinux/selinuxfs.c