summaryrefslogtreecommitdiffstats
path: root/security/integrity
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2018-05-28 00:15:02 +0200
committerMimi Zohar <zohar@linux.vnet.ibm.com>2018-05-31 16:13:22 +0200
commit825b8650dc3dd064969ce343e918d0eb6bf907fb (patch)
tree907d0015b78742a85a0ee226bd45505830faf2b5 /security/integrity
parentIMA: use list_splice_tail_init_rcu() instead of its open coded variant (diff)
downloadlinux-825b8650dc3dd064969ce343e918d0eb6bf907fb.tar.xz
linux-825b8650dc3dd064969ce343e918d0eb6bf907fb.zip
EVM: fix memory leak of temporary buffer 'temp'
The allocation of 'temp' is not kfree'd and hence there is a memory leak on each call of evm_read_xattrs. Fix this by kfree'ing it after copying data from it back to the user space buffer 'buf'. Detected by CoverityScan, CID#1469386 ("Resource Leak") Fixes: fa516b66a1bf ("EVM: Allow runtime modification of the set of verified xattrs") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security/integrity')
-rw-r--r--security/integrity/evm/evm_secfs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c
index a7a0a1acae99..fb8bc950aceb 100644
--- a/security/integrity/evm/evm_secfs.c
+++ b/security/integrity/evm/evm_secfs.c
@@ -158,6 +158,8 @@ static ssize_t evm_read_xattrs(struct file *filp, char __user *buf,
mutex_unlock(&xattr_list_mutex);
rc = simple_read_from_buffer(buf, count, ppos, temp, strlen(temp));
+ kfree(temp);
+
return rc;
}