Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1154934ybt; Wed, 8 Jul 2020 23:23:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzApD8PYTKdz07RfC2Ydvv51qLvpda3Gpozv/ubeSvmTuqTNHY6BcIlP5yIsxhHC7RYFf5k X-Received: by 2002:a05:6402:1655:: with SMTP id s21mr68230688edx.289.1594275829865; Wed, 08 Jul 2020 23:23:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594275829; cv=none; d=google.com; s=arc-20160816; b=wk8XiKa8CWcgvJTUVQI98/Eg1wX6XJsrHyG2meRlcwsJBhuHaCIlRBYg8AAdGwh9tU D00P35+BIUiO0XPXebP7lsb4oHwdAxqacawHKr+2urDkouu9lNGYXyulP/cgnprMYFjN H/VmtQ+rjBXaDBAsFYEoIvKzHVS64eJOZxCVWuudGEvTxxaINgE3+s+n0J/6vYqfO8Sd +IDsrhbQp9xlGd+Q+e8g5Qx5WaKrR2MOHsTS4GFiN6eLZvpeH+PAO1+YQZKTCFbCTThy VIvl9bP4tBYPMd2kuO9RfLQuT3kSxS2RTRgHT620lWX/sbZLWCOOmzh370uxk/gnyc1U FDxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=BMSHcV0geP8nXHQf+FFpMe4jNDRwHDKhciy8Y9r1M+A=; b=0AYt4PZOIsy3kXQD3bhJ9UGdvwXSQiQvgvBoeqhwezppURS2Mkc7KLo2v9uB1PSFLD FVjCZKqlnj1Ko16ITuUJ4/wvdoglCwdmF6ABePegTqt2dGzq98NMD94+m0n7ho3iPw1p 57ToCfLOYhNykcnzvYYmyNRFFP26+OyDRi8uqnBXg6uQ03iPaSBnB8yIiL/eg/WwMHW3 65dFHD90QoFmeNhamLQM4iJFksHPGuyoD4E909QjQeQc8JLkiz6rmOsmXNNqSKg3vB4t CHh+NRMwluLLYfYM7vtcBFphJhX8GudId8lN5L+sfGMem1eCkyJck59suIuKCAmS+8cJ RIFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=W8eLV97P; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b9si1839755edz.313.2020.07.08.23.23.27; Wed, 08 Jul 2020 23:23:49 -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; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=W8eLV97P; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726768AbgGIGUa (ORCPT + 99 others); Thu, 9 Jul 2020 02:20:30 -0400 Received: from linux.microsoft.com ([13.77.154.182]:38148 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726670AbgGIGUQ (ORCPT ); Thu, 9 Jul 2020 02:20:16 -0400 Received: from sequoia.work.tihix.com (162-237-133-238.lightspeed.rcsntx.sbcglobal.net [162.237.133.238]) by linux.microsoft.com (Postfix) with ESMTPSA id 3B7EE20B4908; Wed, 8 Jul 2020 23:20:15 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3B7EE20B4908 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1594275615; bh=BMSHcV0geP8nXHQf+FFpMe4jNDRwHDKhciy8Y9r1M+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W8eLV97P7p0IM4hLJkbuHBItHUgBy+0JExAUlJYkp5ITVj9/c00A9U7e1CUhptlGe 66bplnYDOKmdhx6SXsZLTj8eE2CNEU8q5ucpVitY+vtHoaIQEJUGzK1pmrT2jCV8Pv 8FS1LSPf9KtgFE83S9DUi6KyViJdu4lgj2YT96cI= From: Tyler Hicks To: Mimi Zohar , Dmitry Kasatkin Cc: James Morris , "Serge E . Hallyn" , Lakshmi Ramasubramanian , Prakhar Srivastava , linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org Subject: [PATCH v3 11/12] ima: Use the common function to detect LSM conditionals in a rule Date: Thu, 9 Jul 2020 01:19:10 -0500 Message-Id: <20200709061911.954326-12-tyhicks@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709061911.954326-1-tyhicks@linux.microsoft.com> References: <20200709061911.954326-1-tyhicks@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make broader use of ima_rule_contains_lsm_cond() to check if a given rule contains an LSM conditional. This is a code cleanup and has no user-facing change. Signed-off-by: Tyler Hicks Reviewed-by: Mimi Zohar --- * v3 - No change * v2 - No change security/integrity/ima/ima_policy.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index c4d0a0c1f896..81ee8fd1d83a 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -360,17 +360,10 @@ static bool ima_rule_contains_lsm_cond(struct ima_rule_entry *entry) static void ima_lsm_update_rules(void) { struct ima_rule_entry *entry, *e; - int i, result, needs_update; + int result; list_for_each_entry_safe(entry, e, &ima_policy_rules, list) { - needs_update = 0; - for (i = 0; i < MAX_LSM_RULES; i++) { - if (entry->lsm[i].args_p) { - needs_update = 1; - break; - } - } - if (!needs_update) + if (!ima_rule_contains_lsm_cond(entry)) continue; result = ima_lsm_update_rule(entry); -- 2.25.1