Skip to content

Commit 825b865

Browse files
Colin Ian KingMimi Zohar
authored andcommitted
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: fa516b6 ("EVM: Allow runtime modification of the set of verified xattrs") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Mimi Zohar <[email protected]>
1 parent 53b626f commit 825b865

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

security/integrity/evm/evm_secfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ static ssize_t evm_read_xattrs(struct file *filp, char __user *buf,
158158
mutex_unlock(&xattr_list_mutex);
159159
rc = simple_read_from_buffer(buf, count, ppos, temp, strlen(temp));
160160

161+
kfree(temp);
162+
161163
return rc;
162164
}
163165

0 commit comments

Comments
 (0)