1
0
Fork 0
alistair23-linux/security/selinux/ss
Tom Rix ae3c09e346 selinux: fix double free
commit 65de50969a upstream.

Clang's static analysis tool reports these double free memory errors.

security/selinux/ss/services.c:2987:4: warning: Attempt to free released memory [unix.Malloc]
                        kfree(bnames[i]);
                        ^~~~~~~~~~~~~~~~
security/selinux/ss/services.c:2990:2: warning: Attempt to free released memory [unix.Malloc]
        kfree(bvalues);
        ^~~~~~~~~~~~~~

So improve the security_get_bools error handling by freeing these variables
and setting their return pointers to NULL and the return len to 0

Cc: stable@vger.kernel.org
Signed-off-by: Tom Rix <trix@redhat.com>
Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-24 17:50:48 +02:00
..
avtab.c selinux: convert to kvmalloc 2019-03-12 10:04:02 -07:00
avtab.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372 2019-06-05 17:37:10 +02:00
conditional.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372 2019-06-05 17:37:10 +02:00
conditional.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372 2019-06-05 17:37:10 +02: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.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ebitmap.c selinux: provide __le variables explicitly 2019-05-21 15:49:21 -04:00
ebitmap.h selinux: wrap global selinux state 2018-03-01 18:48:02 -05:00
hashtab.c selinux: wrap global selinux state 2018-03-01 18:48:02 -05:00
hashtab.h selinux: wrap global selinux state 2018-03-01 18:48:02 -05:00
mls.c selinux/stable-4.21 PR 20181224 2018-12-27 12:01:58 -08:00
mls.h selinux: overhaul sidtab to fix bug and improve performance 2018-12-05 16:12:32 -05: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
policydb.c selinux: fix error return code in policydb_read() 2020-06-22 09:31:01 +02:00
policydb.h selinux/stable-5.4 PR 20190917 2019-09-23 11:21:04 -07:00
services.c selinux: fix double free 2020-06-24 17:50:48 +02:00
services.h selinux: use separate table for initial SID lookup 2018-12-05 15:36:12 -05:00
sidtab.c selinux: avoid atomic_t usage in sidtab 2019-08-27 13:26:13 -04:00
sidtab.h selinux: avoid atomic_t usage in sidtab 2019-08-27 13:26:13 -04:00
status.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
symtab.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
symtab.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00