Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp207840pxj; Thu, 20 May 2021 07:41:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyTHrMAYLJzTj39F12t1wyWHPQYh9bVvB1AzZfJvHCu7HatvkXbNH0KILNmqQcpXIv3MBl X-Received: by 2002:a17:906:b0cb:: with SMTP id bk11mr5176703ejb.310.1621521673329; Thu, 20 May 2021 07:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621521673; cv=none; d=google.com; s=arc-20160816; b=Cj5DhPL6ezhJ5BuN7+i3aHW/md+aUAnOIfFrfwropvPGhbTjNtfEdyhkyQlCjAmxST CR0gB37q5CszioB4r8QQ7OgBGttLR+IWIiT0e1oH2NtkyruZnxh21F2ftN8J5cfoP6nQ QPabIG9ZuVKQ9+dVYsMFCzjjg00ASpuSwmwDPh3xwUuLZAr/HHNA8sM5qPbSfgesh77T E/E9uCJ47ji6EbKUGo2wkjzQ53GyZc/D+GdIC3GEBK5Uz851OlZFttW/Os6UUi6RiWYK /2DIw00mO0no4hczTi1s7na+j8sMNw8wctSgTZDyubM2S2Qglp47NyuXpymmJKcv0BbZ 9Zng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=yUe3B+SjQ+06vq14opQHbPHsaG8QaL+iI97WFtUfVqs=; b=eE49A13fP9VtCQ3wLtpOvnMN/8vHJDax1ySoutcrcopV+uENE9Q1FF81a5/cWj0Et1 V5ofEG8Hjq9qISDWvMNWW2uYCOnLhuYkhSk3q42rmftTzVhC/K2QFvfE3oTaho+xqxFC 1/tOrhBYY9Z3w9rSIbG2YCz7SZqdjrX3aXa45DihFN9eySGFaZJQYmNdUO/EGiofhqci TqjKejYroyiJ3OZfd5gjFzGiMJQikTvWizrE7FbOSsXgeMBqAUrGs/xmGaomQhBQ2ZtA vyTX9UVt96LzB766LjImCjMmB6/lv5cDIcHqZvFdjD8Z9eQw1qCQk61HmkmkbwR7N/3q Xt+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z14si2774976ejj.11.2021.05.20.07.40.49; Thu, 20 May 2021 07:41:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231492AbhETJAA (ORCPT + 99 others); Thu, 20 May 2021 05:00:00 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3090 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231403AbhETI75 (ORCPT ); Thu, 20 May 2021 04:59:57 -0400 Received: from fraeml714-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Fm3Qc38Hgz6dtFd; Thu, 20 May 2021 16:52:24 +0800 (CST) Received: from roberto-ThinkStation-P620.huawei.com (10.204.62.217) by fraeml714-chm.china.huawei.com (10.206.15.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 20 May 2021 10:58:34 +0200 From: Roberto Sassu To: , CC: , , , , Roberto Sassu Subject: [PATCH 7/7] evm: Don't return an error in evm_write_xattrs() if audit is not enabled Date: Thu, 20 May 2021 10:57:01 +0200 Message-ID: <20210520085701.465369-8-roberto.sassu@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210520085701.465369-1-roberto.sassu@huawei.com> References: <20210520085701.465369-1-roberto.sassu@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.204.62.217] X-ClientProxiedBy: lhreml752-chm.china.huawei.com (10.201.108.202) To fraeml714-chm.china.huawei.com (10.206.15.33) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch avoids that evm_write_xattrs() returns an error when audit is not enabled. The ab variable can be NULL and still be passed to the other audit_log_() functions, as those functions do not include any instruction. Signed-off-by: Roberto Sassu --- security/integrity/evm/evm_secfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c index ec3ed75a347d..07e263ae13e0 100644 --- a/security/integrity/evm/evm_secfs.c +++ b/security/integrity/evm/evm_secfs.c @@ -196,7 +196,7 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf, ab = audit_log_start(audit_context(), GFP_KERNEL, AUDIT_INTEGRITY_EVM_XATTR); - if (!ab) + if (!ab && IS_ENABLED(CONFIG_AUDIT)) return -ENOMEM; xattr = kmalloc(sizeof(struct xattr_list), GFP_KERNEL); -- 2.25.1