Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp637418pxb; Tue, 5 Apr 2022 16:50:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEz7Ergu7e8kIoTaWRblzj2IZu/ohP2Oo/SBFUagFwTV1iMHI9a97JR4QXhNzRuNAiJ9g7 X-Received: by 2002:a17:90b:4f4d:b0:1c7:5324:c6a0 with SMTP id pj13-20020a17090b4f4d00b001c75324c6a0mr6949064pjb.160.1649202646866; Tue, 05 Apr 2022 16:50:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649202646; cv=none; d=google.com; s=arc-20160816; b=p4kYnaQwf7yIFpFzgpAoft+vOcxA4O57QbYUtVEyKQjaGK/IteB110j/gbHi/KrIA+ ozkO+pGE9Y96mc5x8Emj1hi907Y8X+uuWNyjwPkOOSVcTwo5kFauvIDlOi6ZwHonNXZ5 gptvo12XgQAmZl+6OtWedIEWIq01wFgfe1MvNUdJZliI23pDIlkhvdQkCEuXjxYSd/Eh 9wnFHp9q0QG2A8dq4htnV/PHEcirWZR/rl1vg9n5yaQJozBDYHhRmZa68gLNTPlPKlms kF09E7px92LbOKlbP+Ip6vX3swUNSI0E77XqGj/fy4ffVkj/AY9ROL5QEv/xxcoXyFxx cbXQ== 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=kTGqpED8n3jhO8F0sRJc+rXgUWGCd/9Dr3KcVUgXk78=; b=XGRGJABD3aCuXrDoKPHY+cqJExcT7zYdea/u5UBDATwlOZWsd9AMLwN/kYxTTjXN9V mfoC5xQn5RUhnZHO2Q5T8f6oWDmF+UbL7Xl9HppYnMEg7oU+uX6iX9dgR9leFLsca8Q5 Tq+zfBu/VIC6CwCgeeL7LkO6Z0rGzgWyYDsjDUnYCV1rlHzNjGWv4InUrx5/TW6mUxGN 9cGomEY50G4NbSQ2pz3njsVPC6Q70An4ZHmyqebNBeKHNPdYXdiA0yeva73A54pQqfU5 79GtJQMUkriMILHauZubzTgUenrMWtr0asMOh8N5PrVraRMpfMx3gSF9M4RK+kyM+Ubz AwkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BAh1wMzC; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y11-20020a63de4b000000b00398586b09e0si14527101pgi.278.2022.04.05.16.50.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 16:50:46 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BAh1wMzC; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 18B451B0846; Tue, 5 Apr 2022 16:35:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244481AbiDELgB (ORCPT + 99 others); Tue, 5 Apr 2022 07:36:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244702AbiDEIwe (ORCPT ); Tue, 5 Apr 2022 04:52:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D69C2D95FF; Tue, 5 Apr 2022 01:42:16 -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 72CB060FFC; Tue, 5 Apr 2022 08:42:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88F9EC385A1; Tue, 5 Apr 2022 08:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148135; bh=KRNK4njVsHVBRUVwoLTSxSdSTi/Wg8AxT7cHVB6pSlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BAh1wMzCLhXYficB1VKtNt5o2OdwYdDWQtG7h16FMVW4mhDskrmJ6GToRiDFkB+JM wV9vXg7W9fT9PszH06IREc/BuzyholeogGkz/qFliaCpqbWJorsb7GokePGsXLYsD0 eDG2BcW81m3jXeDJuObbB3vSfeNp/gAub0iJo97Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jarkko Sakkinen , Ahmad Fatoum , Sumit Garg , Andreas Rammhold , Sasha Levin Subject: [PATCH 5.16 0247/1017] KEYS: trusted: Fix trusted key backends when building as module Date: Tue, 5 Apr 2022 09:19:20 +0200 Message-Id: <20220405070401.591509556@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: Andreas Rammhold [ Upstream commit 969a26446bcd142faedfe8c6f41cd7668596c1fa ] Before this commit the kernel could end up with no trusted key sources even though both of the currently supported backends (TPM and TEE) were compiled as modules. This manifested in the trusted key type not being registered at all. When checking if a CONFIG_… preprocessor variable is defined we only test for the builtin (=y) case and not the module (=m) case. By using the IS_REACHABLE() macro we do test for both cases. Fixes: 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework") Reviewed-by: Jarkko Sakkinen Reviewed-by: Ahmad Fatoum Reviewed-by: Sumit Garg Signed-off-by: Andreas Rammhold Tested-by: Ahmad Fatoum Signed-off-by: Ahmad Fatoum Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin --- security/keys/trusted-keys/trusted_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/keys/trusted-keys/trusted_core.c b/security/keys/trusted-keys/trusted_core.c index d5c891d8d353..5b35f1b87644 100644 --- a/security/keys/trusted-keys/trusted_core.c +++ b/security/keys/trusted-keys/trusted_core.c @@ -27,10 +27,10 @@ module_param_named(source, trusted_key_source, charp, 0); MODULE_PARM_DESC(source, "Select trusted keys source (tpm or tee)"); static const struct trusted_key_source trusted_key_sources[] = { -#if defined(CONFIG_TCG_TPM) +#if IS_REACHABLE(CONFIG_TCG_TPM) { "tpm", &trusted_key_tpm_ops }, #endif -#if defined(CONFIG_TEE) +#if IS_REACHABLE(CONFIG_TEE) { "tee", &trusted_key_tee_ops }, #endif }; -- 2.34.1