Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1088747pxp; Thu, 17 Mar 2022 02:32:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzizJI33scg6G38YCyLFC4vcS2QuBUX20/d9sB5FV+6o8iUfTKxPVNegb8N7+CQA9CsbTyV X-Received: by 2002:a17:907:60cf:b0:6db:f0a6:74af with SMTP id hv15-20020a17090760cf00b006dbf0a674afmr3365095ejc.317.1647509544574; Thu, 17 Mar 2022 02:32:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647509544; cv=none; d=google.com; s=arc-20160816; b=YrG/nQ1ooPId//BBzfFARjaAF35+61baU2jPQ0Wpb6oXls5v1X7kfGVuHLiql7bLNP fFMmXtvqIUvc/tslEmoOw5gIu+7/ZnarMJQ9O6O5QsAkiMdGGNiH0mWLWBBuSLKKwPVR bPEeHABRfcTQKeEtDQKuWwvW8hC2LzfJ2XILlF89Mi3QOKS0PQCSuwwU97tHXVMzGixE hMjEdEAqbOlwHHuOE7hAj3+qs7eUA+o3TpiPss5PHAPHCooHiBydQVM96YNdfChVj5ub arFLEEs/R6NisBVLDaulfUrfwyUgyN1HsKimLHOEdPYr2wECjWMImBW6nyuo1bVFzfX2 yVUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=iUjYKxiAbJnhqH7o1oPt13jsIy3grrgChgRYKDVaaXY=; b=IT41t8hVHuyctnaVL7y51NsktD+Ysk9xHU9zlPRQIS6QsaRnYB1URGT7il+SDh3aQN YIP1cHvD7slreSpTjrBI9RM7WQ4+yAxeLc8oxNi0CyWVWx76L2hNM8AVjX8AdGRMeCU7 ZC62mwqp7WRXZr78IIg+7Dcw0xWSHmpElEpADXQM5LUFyKJkEiUVzTOSBnd9Hp3amcxy ghrlGUSCrMhsQscb0HUq+Tdfp/vU6lmJcByKfZHsw7czAal0Hhx8QfuVe9MsTYu+Dh18 IUVcBH+pTmQ3k6gYslJbVPiUWrbmGuve6hG/6YTxW0ELPKF/MRUSPr52Z4zFy8vPTolz pTRg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c13-20020a50e3cd000000b00418c2b5bf50si1116671edm.562.2022.03.17.02.31.59; Thu, 17 Mar 2022 02:32:24 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231287AbiCQIbs (ORCPT + 99 others); Thu, 17 Mar 2022 04:31:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230184AbiCQIbq (ORCPT ); Thu, 17 Mar 2022 04:31:46 -0400 Received: from smtp-42af.mail.infomaniak.ch (smtp-42af.mail.infomaniak.ch [IPv6:2001:1600:3:17::42af]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 602EB1925AA for ; Thu, 17 Mar 2022 01:30:29 -0700 (PDT) Received: from smtp-3-0001.mail.infomaniak.ch (unknown [10.4.36.108]) by smtp-2-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4KK0hN0fGxzMqKB8; Thu, 17 Mar 2022 09:30:28 +0100 (CET) Received: from ns3096276.ip-94-23-54.eu (unknown [23.97.221.149]) by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4KK0hM3lCSzlhMSd; Thu, 17 Mar 2022 09:30:27 +0100 (CET) Message-ID: <42caa9d0-a069-8c6e-314f-7ec87ad95b7f@digikod.net> Date: Thu, 17 Mar 2022 09:31:10 +0100 MIME-Version: 1.0 User-Agent: Subject: Re: [PATCH v1 2/2] certs: Remove panic() calls from system_trusted_keyring_init() Content-Language: en-US To: Jarkko Sakkinen Cc: David Howells , David Woodhouse , "David S . Miller" , Eric Snowberg , Paul Moore , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220311174741.250424-1-mic@digikod.net> <20220311174741.250424-3-mic@digikod.net> <57a2e3ef-5baa-16ef-7865-245134a26e25@digikod.net> From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= In-Reply-To: <57a2e3ef-5baa-16ef-7865-245134a26e25@digikod.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On 17/03/2022 09:30, Mickaël Salaün wrote: > > On 17/03/2022 08:36, Jarkko Sakkinen wrote: >> On Fri, Mar 11, 2022 at 06:47:41PM +0100, Mickaël Salaün wrote: >>> From: Mickaël Salaün >>> >>> Replace panic() calls from device_initcall(system_trusted_keyring_init) >>> with proper error handling using -ENODEV. >>> >>> Suggested-by: Jarkko Sakkinen [1] >>> Link: https://lore.kernel.org/r/Yik0C2t7G272YZ73@iki.fi [1] >>> Signed-off-by: Mickaël Salaün >>> Link: https://lore.kernel.org/r/20220311174741.250424-3-mic@digikod.net >>> --- >>>   certs/system_keyring.c | 26 ++++++++++++++++++++------ >>>   1 file changed, 20 insertions(+), 6 deletions(-) >>> >>> diff --git a/certs/system_keyring.c b/certs/system_keyring.c >>> index 05b66ce9d1c9..428046a7aa7f 100644 >>> --- a/certs/system_keyring.c >>> +++ b/certs/system_keyring.c >>> @@ -148,8 +148,10 @@ static __init int system_trusted_keyring_init(void) >>>                     KEY_USR_VIEW | KEY_USR_READ | KEY_USR_SEARCH), >>>                     KEY_ALLOC_NOT_IN_QUOTA, >>>                     NULL, NULL); >>> -    if (IS_ERR(builtin_trusted_keys)) >>> -        panic("Can't allocate builtin trusted keyring\n"); >>> +    if (IS_ERR(builtin_trusted_keys)) { >>> +        pr_err("Can't allocate builtin trusted keyring\n"); >>> +        return -ENODEV; >>> +    } >>>   #ifdef CONFIG_SECONDARY_TRUSTED_KEYRING >>>       secondary_trusted_keys = >>> @@ -161,14 +163,26 @@ static __init int >>> system_trusted_keyring_init(void) >>>                     KEY_ALLOC_NOT_IN_QUOTA, >>>                     get_builtin_and_secondary_restriction(), >>>                     NULL); >>> -    if (IS_ERR(secondary_trusted_keys)) >>> -        panic("Can't allocate secondary trusted keyring\n"); >>> +    if (IS_ERR(secondary_trusted_keys)) { >>> +        pr_err("Can't allocate secondary trusted keyring\n"); >>> +        goto err_secondary; >>> +    } >>> -    if (key_link(secondary_trusted_keys, builtin_trusted_keys) < 0) >>> -        panic("Can't link trusted keyrings\n"); >>> +    if (key_link(secondary_trusted_keys, builtin_trusted_keys) < 0) { >>> +        pr_err("Can't link trusted keyrings\n"); >>> +        goto err_link; >>> +    } >>>   #endif >>>       return 0; >>> + >>> +err_link: >>> +    key_put(secondary_trusted_keys); >>> + >>> +err_secondary: >>> +    key_put(builtin_trusted_keys); >>> + >>> +    return -ENODEV; >>>   } >>>   /* >>> -- >>> 2.35.1 >>> >> >> Changes make sense to me but you should implement all this to the >> original >> patch set. Do you mean to squash these two patches together? > > You agreed to add this patch on top of the others a few days ago: > https://lore.kernel.org/r/f8b1ea77afe8d6698b4a2122254ff8be310412b1.camel@kernel.org > > > What do you think about Paul's concerns?