linux-stable/security/selinux
Tom Rix 808db35a0a 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-25 15:41:59 +02:00
..
include selinux: use kernel linux/socket.h for genheaders and mdp 2019-05-04 09:15:17 +02:00
ss selinux: fix double free 2020-06-25 15:41:59 +02:00
.gitignore
avc.c selinux: ensure we cleanup the internal AVC counters on error in avc_update() 2020-02-28 16:36:09 +01:00
exports.c
hooks.c selinux: properly handle multiple messages in selinux_netlink_send() 2020-05-05 19:15:53 +02:00
ibpkey.c selinux: Add a cache for quicker retreival of PKey SIDs 2017-05-23 12:28:12 -04:00
Kconfig security: introduce CONFIG_SECURITY_WRITABLE_HOOKS 2017-03-06 11:00:12 +11:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
netif.c
netlabel.c calipso: Add a label cache. 2016-06-27 15:06:17 -04:00
netlink.c
netnode.c
netport.c
nlmsgtab.c rtnetlink: add NEWCACHEREPORT message type 2017-06-21 11:22:52 -04:00
selinuxfs.c Merge branch 'work.memdup_user' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2017-07-05 16:05:24 -07:00
xfrm.c