diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-04-16 19:45:47 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-04-16 19:45:47 +0200 |
commit | 9786cab674574239b04df638f825ee0e7d76a48c (patch) | |
tree | db7eab6edc35fde4ac7e0dbc3d7a0fe076449a32 /security/selinux | |
parent | Merge tag 'ceph-for-5.7-rc2' of git://github.com/ceph/ceph-client (diff) | |
parent | selinux: free str on error in str_read() (diff) | |
download | linux-9786cab674574239b04df638f825ee0e7d76a48c.tar.xz linux-9786cab674574239b04df638f825ee0e7d76a48c.zip |
Merge tag 'selinux-pr-20200416' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
Pull SELinux fix from Paul Moore:
"One small SELinux fix to ensure we cleanup properly on an error
condition"
* tag 'selinux-pr-20200416' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
selinux: free str on error in str_read()
Diffstat (limited to 'security/selinux')
-rw-r--r-- | security/selinux/ss/policydb.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index 70ecdc78efbd..c21b922e5ebe 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1035,14 +1035,14 @@ static int str_read(char **strp, gfp_t flags, void *fp, u32 len) if (!str) return -ENOMEM; - /* it's expected the caller should free the str */ - *strp = str; - rc = next_entry(str, fp, len); - if (rc) + if (rc) { + kfree(str); return rc; + } str[len] = '\0'; + *strp = str; return 0; } |