diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-04-16 10:45:47 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-04-16 10:45:47 -0700 |
commit | 9786cab674574239b04df638f825ee0e7d76a48c (patch) | |
tree | db7eab6edc35fde4ac7e0dbc3d7a0fe076449a32 /security | |
parent | 3fa84bf926f32edf798cfad0317e14df41ac0509 (diff) | |
parent | af15f14c8cfcee515f4e9078889045ad63efefe3 (diff) | |
download | lwn-9786cab674574239b04df638f825ee0e7d76a48c.tar.gz lwn-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')
-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; } |