]> Git Repo - linux.git/commitdiff
EVM: unlock on error path in evm_read_xattrs()
authorDan Carpenter <[email protected]>
Fri, 1 Jun 2018 08:00:05 +0000 (11:00 +0300)
committerMimi Zohar <[email protected]>
Fri, 1 Jun 2018 10:03:08 +0000 (06:03 -0400)
We need to unlock before returning on this error path.

Fixes: fa516b66a1bf ("EVM: Allow runtime modification of the set of verified xattrs")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Mimi Zohar <[email protected]>
security/integrity/evm/evm_secfs.c

index 3cefef3919e5806d3c3c2bd3eab7d6a2600cb628..637eb999e3406df16d084f50e779ed73f34b2ca4 100644 (file)
@@ -147,8 +147,10 @@ static ssize_t evm_read_xattrs(struct file *filp, char __user *buf,
                size += strlen(xattr->name) + 1;
 
        temp = kmalloc(size + 1, GFP_KERNEL);
-       if (!temp)
+       if (!temp) {
+               mutex_unlock(&xattr_list_mutex);
                return -ENOMEM;
+       }
 
        list_for_each_entry(xattr, &evm_config_xattrnames, list) {
                sprintf(temp + offset, "%s\n", xattr->name);
This page took 0.057445 seconds and 4 git commands to generate.