linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] SELinux: Fix lsm_get_self_attr()
@ 2024-02-23 19:05 Mickaël Salaün
  2024-02-23 19:05 ` [PATCH 2/2] AppArmor: " Mickaël Salaün
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Mickaël Salaün @ 2024-02-23 19:05 UTC (permalink / raw)
  To: Casey Schaufler, John Johansen, Paul Moore
  Cc: Mickaël Salaün, James Morris, Serge E . Hallyn,
	linux-kernel, linux-security-module, stable

selinux_lsm_getattr() may not initialize the value's pointer in some
case.  As for proc_pid_attr_read(), initialize this pointer to NULL in
selinux_getselfattr() to avoid an UAF in the kfree() call.

Cc: Casey Schaufler <casey@schaufler-ca.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: stable@vger.kernel.org
Fixes: 762c934317e6 ("SELinux: Add selfattr hooks")
Signed-off-by: Mickaël Salaün <mic@digikod.net>
---
 security/selinux/hooks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index a6bf90ace84c..338b023a8c3e 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -6559,7 +6559,7 @@ static int selinux_getselfattr(unsigned int attr, struct lsm_ctx __user *ctx,
 			       size_t *size, u32 flags)
 {
 	int rc;
-	char *val;
+	char *val = NULL;
 	int val_len;
 
 	val_len = selinux_lsm_getattr(attr, current, &val);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-05-13 14:58 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 19:05 [PATCH 1/2] SELinux: Fix lsm_get_self_attr() Mickaël Salaün
2024-02-23 19:05 ` [PATCH 2/2] AppArmor: " Mickaël Salaün
2024-02-23 21:07   ` Paul Moore
2024-02-26 19:59     ` Paul Moore
2024-02-27 16:01       ` Paul Moore
2024-02-27 22:09         ` Paul Moore
2024-02-27 22:13           ` Paul Moore
2024-02-28 12:53             ` Mickaël Salaün
2024-05-10 16:10         ` John Johansen
2024-05-13 14:57           ` Paul Moore
2024-02-23 19:16 ` [PATCH 1/2] SELinux: " Mickaël Salaün
2024-02-23 20:47   ` Paul Moore
2024-02-23 19:59 ` Mickaël Salaün
2024-02-23 20:03   ` Mickaël Salaün
2024-02-23 21:05     ` Paul Moore
2024-02-23 22:03       ` Mickaël Salaün
2024-02-23 22:21         ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).