From patchwork Thu May 16 16:12:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roberto Sassu X-Patchwork-Id: 10946889 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2745D933 for ; Thu, 16 May 2019 16:17:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16B9228889 for ; Thu, 16 May 2019 16:17:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AD7828A44; Thu, 16 May 2019 16:17:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC72428889 for ; Thu, 16 May 2019 16:17:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726551AbfEPQRn (ORCPT ); Thu, 16 May 2019 12:17:43 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:32946 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726464AbfEPQRn (ORCPT ); Thu, 16 May 2019 12:17:43 -0400 Received: from LHREML713-CAH.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 7994C410BB2BC85C4A0F; Thu, 16 May 2019 17:17:41 +0100 (IST) Received: from roberto-HP-EliteDesk-800-G2-DM-65W.huawei.com (10.204.65.154) by smtpsuk.huawei.com (10.201.108.36) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 16 May 2019 17:17:32 +0100 From: Roberto Sassu To: , , CC: , , , , , Roberto Sassu , Subject: [PATCH 2/4] evm: reset status in evm_inode_post_setattr() Date: Thu, 16 May 2019 18:12:55 +0200 Message-ID: <20190516161257.6640-2-roberto.sassu@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516161257.6640-1-roberto.sassu@huawei.com> References: <20190516161257.6640-1-roberto.sassu@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.204.65.154] X-CFilter-Loop: Reflected Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a call to evm_reset_status() in evm_inode_post_setattr(), before security.evm is updated. The same is done in the other evm_inode_post_* functions. Fixes: 523b74b16bcbb ("evm: reset EVM status when file attributes change") Signed-off-by: Roberto Sassu Cc: stable@vger.kernel.org --- security/integrity/evm/evm_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c index b6d9f14bc234..b41c2d8a8834 100644 --- a/security/integrity/evm/evm_main.c +++ b/security/integrity/evm/evm_main.c @@ -512,8 +512,11 @@ void evm_inode_post_setattr(struct dentry *dentry, int ia_valid) if (!evm_key_loaded()) return; - if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) + if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) { + evm_reset_status(dentry->d_inode); + evm_update_evmxattr(dentry, NULL, NULL, 0); + } } /*