lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 28 Jan 2022 21:28:57 +0100
From:   vbendel@...hat.com
To:     paul@...l-moore.com, stephen.smalley.work@...il.com,
        eparis@...isplace.org
Cc:     omosnace@...hat.com, selinux@...r.kernel.org,
        linux-kernel@...r.kernel.org, Vratislav Bendel <vbendel@...hat.com>
Subject: [PATCH 2/3] selinux: fix double free of cond_list on error paths

From: Vratislav Bendel <vbendel@...hat.com>

On error path from cond_read_list() and duplicate_policydb_cond_list()
the cond_list_destroy() gets called a second time in caller functions,
resulting in NULL pointer deref.
Fix this by resetting the cond_list_len to 0 in cond_list_destroy(),
making subsequent calls a noop.

Signed-off-by: Vratislav Bendel <vbendel@...hat.com>
---
 security/selinux/ss/conditional.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
index 1d0e5f326b62..8bc16ad3af9e 100644
--- a/security/selinux/ss/conditional.c
+++ b/security/selinux/ss/conditional.c
@@ -151,6 +151,8 @@ static void cond_list_destroy(struct policydb *p)
 
 	for (i = 0; i < p->cond_list_len; i++)
 		cond_node_destroy(&p->cond_list[i]);
+	p->cond_list_len = 0;
+
 	kfree(p->cond_list);
 	p->cond_list = NULL;
 }
-- 
2.26.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ