Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5981147pxb; Thu, 27 Jan 2022 04:02:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9C7a4ajjv52LJ+q2s0EYZJIpk2GTlqirdYPQWISd+Rbg2JaTdAMVKIYpFbtbOcnQoenFO X-Received: by 2002:aa7:946e:: with SMTP id t14mr2589095pfq.76.1643284952877; Thu, 27 Jan 2022 04:02:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643284952; cv=none; d=google.com; s=arc-20160816; b=I/2fi3MOwNcZ2b4RX14BaFpvFr6tLMEdWUTzllCIwB/RlNvgqDj83CfK3KcS9N1v6M zVxg19h7d+cTv9PCe8W5PQos5cVRvHAYWWokMp1RFQa5TaKxseFBU+9sfdoKxdG47HNv OSY9XIjxYxYffq88VKV/AimWTYWb0IZvwCKsDLS3Qmhz+6PkWHjCuqBKS9CeGi8qRmO+ Dq2YuVLujUN7RE5mKGtxTooXUGMeu8IOCdFEiO5soAohqhkcSq2d+Mw3SOO3I+84yOs3 eimb4EB1A95hZ3vwMwOMF46MaR7xqMrJBYh0XmmC8694WXvyin2BUpLL/iYCoNOfyGXc uNNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+dTkxGYUlNJhi8u43pDWWFCeIctkqPXxzUpp/O4S0VA=; b=b7mO2W1QqPb+jRvmkg1Nl4W6fuqFFl7GVcLqRVYAmTp5+hmDpda2A1lToJAOAafhzJ Yo8tkUb9CUv/fg4JGFPYMOQWjI6N5hCQ+CRBdxqm+8vt4STh4X7YcnKOyOpQmrLyOFRU x9M/1G3gowRM58PqJnrXZdLRvZ96w1pukGrwkDMy99yQA7xqKerJnEi865N4LxRAf6uA jmt2oKjKg5igH9HlJoepDcBxZNmJ3vx8ZW9LTcWGasTJXO2+4e82nCqN2vDoEFA3dIAy cF5wjzn5VUBm2q9R3QhRG/3V01Cd+6M6WFpD1X+8FYCQhm+JKymOvPvpx/EcSJfoIb09 3GDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nU20B3sS; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si2135792plh.531.2022.01.27.04.02.19; Thu, 27 Jan 2022 04:02:32 -0800 (PST) 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=@linaro.org header.s=google header.b=nU20B3sS; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236314AbiA0FnA (ORCPT + 99 others); Thu, 27 Jan 2022 00:43:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236304AbiA0FnA (ORCPT ); Thu, 27 Jan 2022 00:43:00 -0500 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9956BC06173B for ; Wed, 26 Jan 2022 21:42:59 -0800 (PST) Received: by mail-lj1-x234.google.com with SMTP id z20so2652725ljo.6 for ; Wed, 26 Jan 2022 21:42:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+dTkxGYUlNJhi8u43pDWWFCeIctkqPXxzUpp/O4S0VA=; b=nU20B3sS+LfpIOekeMws0AVgBv3fCRJS76MRe4s0LAuZQVhhAvtfAV5olP2ivrN59l 5zeRsgnktL6Gh4MkXAVpb6Bp23tNdq/1tLPjsvfLRwI3OMfBwNGsB0Jc3RvHLlPfBfnL HKo9in79rxbzyxK8JtvmKzXpBgAV9ugJJTxOVzXwP7Q8+62WUgzkuWniGrg2gYPDMoBF c7p1VpqVy6TN2X8A3kTEI9fSO9lZvhhZUlq7TOQeUiAolULuL+SdRceM15KyO5pjO0cH 7dDaCp1y9OQHXifcOULncCnTUu3T7HLzB3+F3W8CoQ+nfl+G+vpgHa76c8ugsypfL8JO JlYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+dTkxGYUlNJhi8u43pDWWFCeIctkqPXxzUpp/O4S0VA=; b=aQ3LbW2Ui0srUgHuGGZK+yP+Kc8hpjNM/C6SCbf5+Eqb6Pc2J92BTxcCQNaCU88LdJ m+EWn174lMbY9yqwWW8zcCQPdpeyvNhx/kJT3Tph6d0cFVSV5WnCnqFIoqzCiCDhqHLJ 4yFYNmDku8LjQ+3KK36cAV0a827DkZkfHp9dNfuN3RQHTvkHZx47bzegeSDBCf7RY3to VjN4Mms1EtU6z6lCsF+Y0qYpKswMZWQVuUBhZC4Z2mdgikWSeGp0S0D+++KB+0xC5Emf NXrQVETdSiuYPBSG/s0ikuX6i/EaFnm7Vg+7suOl+3fgUEL+i+mQu/DLH8QEJWdL1kqV 9vOw== X-Gm-Message-State: AOAM533ouMOgh3+8jbXDjLTXtcIGUmTxccKXDj3o4RppzJNYWhwy0Xet plcLrkmPWYELEwotDCDi6sPI0MqrxP9QBHh39g/iZw== X-Received: by 2002:a2e:8754:: with SMTP id q20mr1764155ljj.71.1643262177779; Wed, 26 Jan 2022 21:42:57 -0800 (PST) MIME-Version: 1.0 References: <20220126203243.231822-1-dave.kleikamp@oracle.com> In-Reply-To: <20220126203243.231822-1-dave.kleikamp@oracle.com> From: Sumit Garg Date: Thu, 27 Jan 2022 11:12:46 +0530 Message-ID: Subject: Re: [PATCH v2] KEYS: trusted: Avoid calling null function trusted_key_exit To: Dave Kleikamp Cc: linux-kernel@vger.kernel.org, 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 27 Jan 2022 at 02:02, Dave Kleikamp wrote: > > 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 > --- > v2 changes: > Header cleanup - removed empty line and cc:stable > security/keys/trusted-keys/trusted_core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Thanks for the fix. Reviewed-by: Sumit Garg -Sumit > diff --git a/security/keys/trusted-keys/trusted_core.c b/security/keys/trusted-keys/trusted_core.c > index d5c891d8d353..8c14e04e2112 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.35.0 >