Skip to content

Commit b5c90a7

Browse files
Dan CarpenterMimi Zohar
authored andcommitted
EVM: unlock on error path in evm_read_xattrs()
We need to unlock before returning on this error path. Fixes: fa516b6 ("EVM: Allow runtime modification of the set of verified xattrs") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Mimi Zohar <[email protected]>
1 parent a41d80a commit b5c90a7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

security/integrity/evm/evm_secfs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,10 @@ static ssize_t evm_read_xattrs(struct file *filp, char __user *buf,
147147
size += strlen(xattr->name) + 1;
148148

149149
temp = kmalloc(size + 1, GFP_KERNEL);
150-
if (!temp)
150+
if (!temp) {
151+
mutex_unlock(&xattr_list_mutex);
151152
return -ENOMEM;
153+
}
152154

153155
list_for_each_entry(xattr, &evm_config_xattrnames, list) {
154156
sprintf(temp + offset, "%s\n", xattr->name);

0 commit comments

Comments
 (0)