Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp241573rdd; Wed, 22 Nov 2023 14:47:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzhoeuJ0f7+W0UrRYitO/LUzFwapRO/yVMynQEiDJxPb/ZNFT8Yk2KeObXf9nolgPkr2xG X-Received: by 2002:a05:6a21:3288:b0:186:736f:7798 with SMTP id yt8-20020a056a21328800b00186736f7798mr4311727pzb.11.1700693279350; Wed, 22 Nov 2023 14:47:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700693279; cv=none; d=google.com; s=arc-20160816; b=rlcKiK2BoVQpyNsZlvD2pyFeDCHhS5PD0nZ2GOEBmN8Hrue4KdcVbVIrF2rZiNdIl+ Ds2cb3adNlCW9Ye3PKgt15E/Kq4iyenz7wG4riT3wzntHpzbkGNnGaRLGgoBx+DQhDlm H+nQ1z30dYJ+iaOCABJhbdVRIsGi11Wia0x6KTI6gNpkK5Qzh6+Rwn84sfoJaz6oMuTJ fTmOPUxRczRPfJEoDo60m1z8P4yjNbY4JiNnHMmEN7qI/WPC8haWbUW8nB48PTUwMxZ7 5OkT2ejkZmqvUPFB6LZat3Ent3FCDiF1oPZeqcdBebDwrUX/+y0av/AXxVScBUycpGuf /hgQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NnRIlJI6Jdmd79h9TxFEwIOw5Gi77BWCazL0INdTA4s=; fh=z9F1xB7Zil5negm71YQkGNSLKveYIL/Zk7w910Ma8Q0=; b=ykMw3BWZ28C6+GVSlbxA8uHsGr6gKPuDSTeNKUxUIj2BMkxqEhl5Li4ufkssiRq84K 3WL87Rj5AFd7ay6SNCeB/XiWXKOCCHlYhDL1GAm+ToKrTSraFFWcDfBH7gJbWSRbv1Wm /pb+LWDM/fK3AwdzH1QLzIWo86qoUPYae5C88lP9MIjNOJV5Qa8COKiL36b7mlBoXVQ8 3BBePhrjQCzucU1UnTX+fO3SrFjF1Oa3wEsb26os9EbvOz/OQQXox11iVFL77ZO0qzWA jhTwsSNATJSzmM7uy/AAX/W44umpROySuyb5RiyaLnvi5044sv4w13a3UB/knWy1gjg/ GIiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o9ASBCAx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id k38-20020a63ff26000000b005b92fb731a9si41121pgi.834.2023.11.22.14.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 14:47:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o9ASBCAx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5A3A9837FA3D; Wed, 22 Nov 2023 14:47:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344415AbjKVWrd (ORCPT + 99 others); Wed, 22 Nov 2023 17:47:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231952AbjKVWrc (ORCPT ); Wed, 22 Nov 2023 17:47:32 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4397712A for ; Wed, 22 Nov 2023 14:47:29 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B1FDC433C7; Wed, 22 Nov 2023 22:47:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700693248; bh=zAaMHwAz6fQIMNy0cpFdvF6MYVuva8LCFObd/51W7U4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o9ASBCAxjepYSLCKpUhXqOTcz8HeeVQG9sJv//XEYxWgYrMZO5tnjra4JeXJZ6+xu a/gXdFIsEm9KLJvYS4P2s9yLX4eBX0GTq18NjC/79OAuUSjXqihSeEsuz/jXu/7l+O 0tFo1EYPYxovDTaRaXJ5hNqWdN9ds0cEd0FFzGRuRPtuAormWPk2aUDiRE2EGCl/Zv KEd0NI+TOy59khYiULMv+fT2nLAqhqlNI+YMNS1J3lavvcMwH2/GuitmY6F/VIXS1/ J3HBYsTuW+ZXE/jrw1uyIqBcwjGyv+xEpr8IQ6kAa2z7+F2dvfpcMIezbJtI5h8GWb /h1X7fs6VAVUw== From: Arnd Bergmann To: linux-nvme@lists.infradead.org Cc: Arnd Bergmann , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , linux-kernel@vger.kernel.org Subject: [PATCH v3 1/3] nvme: target: fix nvme_keyring_id() references Date: Wed, 22 Nov 2023 23:47:17 +0100 Message-Id: <20231122224719.4042108-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231122224719.4042108-1-arnd@kernel.org> References: <20231122224719.4042108-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, 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 fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 22 Nov 2023 14:47:48 -0800 (PST) From: Arnd Bergmann In configurations without CONFIG_NVME_TARGET_TCP_TLS, the keyring code might not be available, or using it will result in a runtime failure: x86_64-linux-ld: vmlinux.o: in function `nvmet_ports_make': configfs.c:(.text+0x100a211): undefined reference to `nvme_keyring_id' Add a check to ensure we only check the keyring if there is a chance of it being used, which avoids both the runtime and link-time problems. Signed-off-by: Arnd Bergmann --- drivers/nvme/target/configfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c index 9eed6e6765ea..e307a044b1a1 100644 --- a/drivers/nvme/target/configfs.c +++ b/drivers/nvme/target/configfs.c @@ -1893,7 +1893,7 @@ static struct config_group *nvmet_ports_make(struct config_group *group, return ERR_PTR(-ENOMEM); } - if (nvme_keyring_id()) { + if (IS_ENABLED(CONFIG_NVME_TARGET_TCP_TLS) && nvme_keyring_id()) { port->keyring = key_lookup(nvme_keyring_id()); if (IS_ERR(port->keyring)) { pr_warn("NVMe keyring not available, disabling TLS\n"); -- 2.39.2