Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp689055pxb; Tue, 5 Apr 2022 18:53:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQnm2SZNac5t4qWMO27+bAqNpKy53YE6vQi+n1aTo6W62BVHkMtE1gX2A0emr7WfOt83HH X-Received: by 2002:a17:90b:3650:b0:1ca:a667:b17c with SMTP id nh16-20020a17090b365000b001caa667b17cmr7296075pjb.180.1649210001636; Tue, 05 Apr 2022 18:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649210001; cv=none; d=google.com; s=arc-20160816; b=xMFb5rDjat67qL9PaDpNp2adkpdAsd/wP0OPF1j8CayAwkkMi6089Rd/vhIYhePzmd m2eJlZ6pMCAl21OT9VErS8nvbwE96WIu56C9GSSx/OU1iHFIz0ybCT2PAmPyul6XCqbi U71Cwta4BNb5j6xkaTK5bgMIFBveK5xwqeGZBDubHPr9VXAvx9dU5g9EVyWBOpLt7iqO UAzqPlCJ74pb6lcHmAG32ys+dIE5Zf//8dCkgExhGEtoNkQoLsH6WMEjthBLM4jFLYCU QYCVBd3s7TJUmOLJkHlCmvd7Qq79rgyLwS6nxz7tmDMh3ucODiAxYJMr1FnHkc+dUSfF Ws8Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bKSKmCtGr3ld0/2z4WBZdEeR50azuV7tCrqZs+mMC1g=; b=cjV7FOmbX0sgcrFD0Sa/vfQ8gKiA/5dfqAS+iGliy5XEXENP+jG/m9pOJt3mUA/Fi+ SzqofzOLhlY5RjXkzqNe2MKNsZOOIbWK8xd7iyUxtHngEjaWXiuTFeht+VCxosdZKW7S 7s9y6dDCOy33KdiMxmexz7UThkdiKldMB8KG8B6I5CGoE8ksjE1Qs18KjGmX/JTYnPeR sAmqdhvRs2TkPSfwDKbLbANdysGBIQbwHoqFqjYWTPKxpSECdqfk/hI010j9RswVkX5E BOHQJtSU2ygOPxfuH2oCYBfuIXzXf5+JjQlVAjHdr01amSt0DbxJNuBxQWYEe05fVvLH 6Sgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ruQKorjo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v4-20020a637a04000000b003820fac6c22si14060505pgc.340.2022.04.05.18.53.06; Tue, 05 Apr 2022 18:53:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ruQKorjo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354806AbiDELhA (ORCPT + 99 others); Tue, 5 Apr 2022 07:37:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244704AbiDEIwe (ORCPT ); Tue, 5 Apr 2022 04:52:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25E7D18E24; Tue, 5 Apr 2022 01:42:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B174B609D0; Tue, 5 Apr 2022 08:42:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B576C385A1; Tue, 5 Apr 2022 08:42:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148141; bh=YQar6ezHZkPY8X6SYpKiX/qtDQj2Nb/lf+/JJVypKo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ruQKorjoV32pU39DqmwNgMmTSWyTIew6GNyb5YXkNdhOMPzG+HkcfhR7LfiWR9dZE iF34rM5Egm5c+mApDleQUXP7EM6wjRzcWuiMFZqyO+E7xJVMM5GGGsQtKNesRitkJV 4W0FnMbcA9b3jT+mOMhZk8D8D/YVtKQqXHeMSP6s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Kleikamp , Sumit Garg , James Bottomley , Jarkko Sakkinen , Mimi Zohar , David Howells , James Morris , "Serge E. Hallyn" , linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, Sasha Levin Subject: [PATCH 5.16 0248/1017] KEYS: trusted: Avoid calling null function trusted_key_exit Date: Tue, 5 Apr 2022 09:19:21 +0200 Message-Id: <20220405070401.621647117@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Kleikamp [ Upstream commit c5d1ed846e15090bc90dfdaafc07eac066e070bb ] If one loads and unloads the trusted module, trusted_key_exit can be NULL. Call it through static_call_cond() to avoid a kernel trap. Fixes: 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework") Signed-off-by: Dave Kleikamp Cc: Sumit Garg Cc: James Bottomley Cc: Jarkko Sakkinen Cc: Mimi Zohar Cc: David Howells Cc: James Morris Cc: "Serge E. Hallyn" Cc: linux-integrity@vger.kernel.org Cc: keyrings@vger.kernel.org Cc: linux-security-module@vger.kernel.org Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin --- security/keys/trusted-keys/trusted_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/keys/trusted-keys/trusted_core.c b/security/keys/trusted-keys/trusted_core.c index 5b35f1b87644..9b9d3ef79cbe 100644 --- a/security/keys/trusted-keys/trusted_core.c +++ b/security/keys/trusted-keys/trusted_core.c @@ -351,7 +351,7 @@ static int __init init_trusted(void) static void __exit cleanup_trusted(void) { - static_call(trusted_key_exit)(); + static_call_cond(trusted_key_exit)(); } late_initcall(init_trusted); -- 2.34.1