From: Dan Carpenter Date: Fri, 1 Jun 2018 08:00:05 +0000 (+0300) Subject: EVM: unlock on error path in evm_read_xattrs() X-Git-Tag: v4.18-rc1~100^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5c90a7526fe39164c2204f0404ce8f8ff21e522;p=thirdparty%2Flinux.git EVM: unlock on error path in evm_read_xattrs() 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 Signed-off-by: Mimi Zohar --- diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c index 3cefef3919e58..637eb999e3406 100644 --- a/security/integrity/evm/evm_secfs.c +++ b/security/integrity/evm/evm_secfs.c @@ -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);