linux/security/selinux/ss
Vratislav Bendel 186edf7e36 selinux: fix double free of cond_list on error paths
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.

Also consistently reset the cond_list pointer to NULL after freeing.

Cc: stable@vger.kernel.org
Signed-off-by: Vratislav Bendel <vbendel@redhat.com>
[PM: fix line lengths in the description]
Signed-off-by: Paul Moore <paul@paul-moore.com>
2022-02-02 11:02:10 -05:00
..
avtab.c selinux: constify some avtab function arguments 2021-05-10 21:35:02 -04:00
avtab.h selinux: constify some avtab function arguments 2021-05-10 21:35:02 -04:00
conditional.c selinux: fix double free of cond_list on error paths 2022-02-02 11:02:10 -05:00
conditional.h selinux: refactor changing booleans 2020-08-17 21:00:33 -04:00
constraint.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
context.c selinux: hash context structure directly 2020-04-17 16:04:34 -04:00
context.h selinux: move context hashing under sidtab 2020-04-17 16:04:38 -04:00
ebitmap.c selinux: mark some global variables __ro_after_init 2021-01-12 10:08:55 -05:00
ebitmap.h selinux: hash context structure directly 2020-04-17 16:04:34 -04:00
hashtab.c selinux: fix NULL-pointer dereference when hashtab allocation fails 2021-11-19 16:11:39 -05:00
hashtab.h selinux: refactor changing booleans 2020-08-17 21:00:33 -04:00
mls_types.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mls.c selinux: fix all of the W=1 build warnings 2021-10-13 16:31:51 -04:00
mls.h selinux: hash context structure directly 2020-04-17 16:04:34 -04:00
policydb.c selinux: correct the return value when loads initial sids 2021-08-02 09:59:50 -04:00
policydb.h selinux: prepare for inlining of hashtab functions 2020-07-09 19:05:36 -04:00
services.c selinux: fix all of the W=1 build warnings 2021-10-13 16:31:51 -04:00
services.h selinux: convert policy read-write lock to RCU 2020-08-25 08:34:47 -04:00
sidtab.c selinux: Use struct_size() helper in kmalloc() 2021-12-05 21:58:32 -05:00
sidtab.h selinux: fix race between old and new sidtab 2021-04-07 20:42:56 -04:00
symtab.c selinux: prepare for inlining of hashtab functions 2020-07-09 19:05:36 -04:00
symtab.h selinux: specialize symtab insert and search functions 2020-07-08 20:21:43 -04:00