Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1047431pxp; Thu, 17 Mar 2022 01:23:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxljMqcrYVDCL87V49rTtqEHdoOh8p6y9HgxbvGmDRmTTYsvnboF8Dlh1qSZtMDEl/27q9y X-Received: by 2002:a17:906:383:b0:6d6:d54b:438c with SMTP id b3-20020a170906038300b006d6d54b438cmr3216544eja.219.1647505427079; Thu, 17 Mar 2022 01:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647505427; cv=none; d=google.com; s=arc-20160816; b=Bf2dRULiZgT4FJo0ujZ5/svhIdlN1RaI5QN1/xA0xlceAXX8ino2bDTVUU5v42JZm/ +adv1KTw9bNrJ94N3ILTUj9YKTNmZEN4IqfloCtXIz0bRMU3p+t0cBza245gZSpsawJQ phJqFpcOSRDqnNcqAWLgwXI4UsnkONZZUzV/dUo8Q+o1sKdenwjgscxN3OLto2Nxk/Sx E9m0mFfdwOFqeZiHxvRNH2oM2yzBpfiLQFhz+9CX9+W6KqzFV1W7bWvi5bfvqaXB8dgF X50ykHGx0fgK+nH/oznIFH8/Vvp53fEs1rteGhkGBiMMS0h/HsSMWLFJ/gqGZD4HuQFC ykxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=nocqX4/Zx6OCX21XGusVtLxrFS1VDqqkJj1IXbSrL/s=; b=MPxLLUzLqXCuPWUCb/LFUEOxocMgnfkIO7JblpYtslF7REKRAklliXSUCsRxr99Xql +Pn9shiYhaXGzS1u2p4SkxfqoHpyYch6tMXeHSOVLy6kAIhREcXd4kuOPq5qiajsXwB5 hq/R6sMBSqBVlxuvRcvLzHbdnBp4pREEPLvR5Ua6tuVIJjDpu6Eq4hOYSyBWUZswjEAJ 2U82rSKW/jVj+Y3nFLY9BhrR2Ffup8WDREAS15uvbvsP8dBZiJ2aWaa8pL6GW5uuGWEK J9JzNt4xpeY9SQCwzkGvvi7rLPCMVMFMlqVWhsIFakbA0KpRGH4JQIOXcnOVHFjfXRen nP2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FDMQbANA; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a13-20020a170906368d00b006b20574c165si2388368ejc.752.2022.03.17.01.23.12; Thu, 17 Mar 2022 01:23:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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=@kernel.org header.s=k20201202 header.b=FDMQbANA; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229847AbiCQHiO (ORCPT + 99 others); Thu, 17 Mar 2022 03:38:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbiCQHiO (ORCPT ); Thu, 17 Mar 2022 03:38:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77768EE4DE; Thu, 17 Mar 2022 00:36:58 -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 ams.source.kernel.org (Postfix) with ESMTPS id 24B77B81DBB; Thu, 17 Mar 2022 07:36:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71EE9C340EE; Thu, 17 Mar 2022 07:36:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647502615; bh=Lq/j8Muv+YhQPhXUdIbr3sM8xNZ7ybJA7We/n6/A47c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FDMQbANAaOAqnU3GhJW4lx8iDyzGXT0FrAVV49RebNIZTkND47CSxvBFhEDFB+ccw PCQlNa+IwNgisR6eoDYOAUUT1AGJEDRuh+MU9uhokgF5+dqZkXSvN7zHyF/uji85Gh /QOpi+DDDHR3v0YAOGYM3Tm8JmyklxRQ7wqS/EM57C+GzA8JsUADxKbBtWAWjQ7pjT Lyzf08H/q+QCh8j89EvKl8RsWEnF+wvOSlHLAcSyIyNUONWZYEOtT2X+g3jj/osrsq MDAycSjiJ8sXcdZtLBNm5lRRM68QHMFk7REFVNj4q5K8yaAGOGZRe2bhG+CXJtttGw kyqN+a0Uz2Gow== Date: Thu, 17 Mar 2022 09:36:06 +0200 From: Jarkko Sakkinen To: =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= Cc: David Howells , David Woodhouse , "David S . Miller" , Eric Snowberg , =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= , Paul Moore , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 2/2] certs: Remove panic() calls from system_trusted_keyring_init() Message-ID: References: <20220311174741.250424-1-mic@digikod.net> <20220311174741.250424-3-mic@digikod.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220311174741.250424-3-mic@digikod.net> X-Spam-Status: No, score=-8.6 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-crypto@vger.kernel.org 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. BR, Jarkko