selinux: fix sel_read_bool() allocation and error handling
authorStephen Smalley <stephen.smalley.work@gmail.com>
Tue, 2 Sep 2025 13:11:08 +0000 (09:11 -0400)
committerPaul Moore <paul@paul-moore.com>
Wed, 3 Sep 2025 21:34:32 +0000 (17:34 -0400)
commit59ffc9beeb8b332940d36f4b9803352b7f893f5a
tree59ed4045c16c480b83bca9035c59172e882c8bba
parentf20e70a341dd67ac4aca23f93b6acdca6779e69d
selinux: fix sel_read_bool() allocation and error handling

Switch sel_read_bool() from using get_zeroed_page() and free_page()
to a stack-allocated buffer. This also fixes a memory leak in the
error path when security_get_bool_value() returns an error.

Reported-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/selinuxfs.c