OrangePi_CM5/security/selinux/ss
Vratislav Bendel f446089a26 selinux: fix double free of cond_list on error paths
commit 186edf7e368c40d06cf727a1ad14698ea67b74ad upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-08 18:30:34 +01:00
..
avtab.c selinux: fix cond_list corruption when changing booleans 2021-04-14 08:41:57 +02:00
avtab.h selinux: fix cond_list corruption when changing booleans 2021-04-14 08:41:57 +02:00
conditional.c selinux: fix double free of cond_list on error paths 2022-02-08 18:30:34 +01:00
conditional.h
…
constraint.h
…
context.c
…
context.h
…
ebitmap.c
…
ebitmap.h
…
hashtab.c selinux: fix NULL-pointer dereference when hashtab allocation fails 2021-11-26 10:39:21 +01:00
hashtab.h
…
mls.c
…
mls.h
…
mls_types.h
…
policydb.c selinux: correct the return value when loads initial sids 2021-08-12 13:22:16 +02:00
policydb.h
…
services.c selinux: fix race condition when computing ocontext SIDs 2021-11-18 14:03:44 +01:00
services.h
…
sidtab.c selinux: fix race between old and new sidtab 2021-04-14 08:41:57 +02:00
sidtab.h selinux: fix race between old and new sidtab 2021-04-14 08:41:57 +02:00
symtab.c
…
symtab.h
…