Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp125113iof; Sun, 5 Jun 2022 23:06:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkAuWzW0J84+Pf++TCdgeDgHljIn0F8vC3aV6ZZ84eAyhSBbEviT8faFrjOZrcaTALcXji X-Received: by 2002:a63:6b4a:0:b0:3fa:e050:ae9b with SMTP id g71-20020a636b4a000000b003fae050ae9bmr20430347pgc.602.1654495619751; Sun, 05 Jun 2022 23:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654495619; cv=none; d=google.com; s=arc-20160816; b=oimUOSY0gG34T5I03GaSp3Ksasfr+mfJkC+6KC3lZ7wdJSQ7Z5r/4dno0zx8LBYne+ blp/qJ9Q+fPM1Ro4W0U78Nt7YTjbaCGpXR+Thyjg7mDe/UnBTI7Kr1/Y0GfU2fTM4qZA QzBYrZo8gaY/wk8MWiyfLK0lxtGbWomTZBZ79DfZgrDhYnkEqcgIuXRWErrPzXxTfRoi FolJAlul1JvNbNq+K6cuSG977VUtOSzSshfYDp4LaQzQhShX5jF7pjcG1VesGEY5Zilq ntTXVMma+SLCiTLaT2cmL51+N3vQDoImw/odDRIE/tx+ky+7vTASsg5HnJEmOuaDjeh1 TpBQ== 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=qS+YgTI1h06WcgfR3zF7dUJAOT68ty6TT5mRJkvcUPE=; b=XBEVLJlySAV7Uy2xof8alFPNTXeelBZ25m5tbSGofuXisrHZnyFBmud+5+riSKfVp3 eC+TNkNBs/sUQ2gZgh+L3jY4+dizGF3XzZ8YMESapvTPBWnjUlsdgwNdFeD0+mK6vaKC WrITfrGISCx3q2jdQSVmDRW11VHGHGr03x5D+JrYv6Ay53i8/tUmZfHa+IGO/UXYbhqY piMtcMoqVqmfVHCVzgeP+BdNQTgQuBTHf21zhbOWQ5cU4ffvbZvg9gzsaNpp7CGMBc31 i+aWXN5GhMHJBJDmwSIS2J1VZkDBCKBo79vQLb3jNAkEywHR5Nfg+7Dtft21f8L9pOM5 t1sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gFfz4iDj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id np9-20020a17090b4c4900b001e26f73d372si25412981pjb.58.2022.06.05.23.06.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 23:06:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gFfz4iDj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 5AE1F18AD82; Sun, 5 Jun 2022 21:56:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346436AbiFCSAR (ORCPT + 99 others); Fri, 3 Jun 2022 14:00:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347184AbiFCRwG (ORCPT ); Fri, 3 Jun 2022 13:52:06 -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 B2AA2580ED; Fri, 3 Jun 2022 10:50:15 -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 4D11860EE9; Fri, 3 Jun 2022 17:50:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B8F1C385A9; Fri, 3 Jun 2022 17:50:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654278614; bh=KsUOLGTDYelQAHVm3ByM7FFacF11O4D+xvLcvKIQpWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gFfz4iDj7Pci1Hb0XOPqEuAX48SftYVUnw1EyGYyOQTBYnFcB6nwRnHidySRPOKY1 WCC11evIUqyBcYHXYY5BESejSgXDqOIZPumBmWr9zl5EPzsF7W5UaFSH3McXKJY8RR mN0d9t2kktqOWldDO8UfsDpTopoNFDIAboMuHeCA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Bartschies , Steffen Klassert , Sasha Levin Subject: [PATCH 5.15 05/66] net: af_key: check encryption module availability consistency Date: Fri, 3 Jun 2022 19:42:45 +0200 Message-Id: <20220603173820.822430301@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603173820.663747061@linuxfoundation.org> References: <20220603173820.663747061@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=-3.1 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=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 From: Thomas Bartschies [ Upstream commit 015c44d7bff3f44d569716117becd570c179ca32 ] Since the recent introduction supporting the SM3 and SM4 hash algos for IPsec, the kernel produces invalid pfkey acquire messages, when these encryption modules are disabled. This happens because the availability of the algos wasn't checked in all necessary functions. This patch adds these checks. Signed-off-by: Thomas Bartschies Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- net/key/af_key.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/key/af_key.c b/net/key/af_key.c index 92e9d75dba2f..339d95df19d3 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -2900,7 +2900,7 @@ static int count_ah_combs(const struct xfrm_tmpl *t) break; if (!aalg->pfkey_supported) continue; - if (aalg_tmpl_set(t, aalg)) + if (aalg_tmpl_set(t, aalg) && aalg->available) sz += sizeof(struct sadb_comb); } return sz + sizeof(struct sadb_prop); @@ -2918,7 +2918,7 @@ static int count_esp_combs(const struct xfrm_tmpl *t) if (!ealg->pfkey_supported) continue; - if (!(ealg_tmpl_set(t, ealg))) + if (!(ealg_tmpl_set(t, ealg) && ealg->available)) continue; for (k = 1; ; k++) { @@ -2929,7 +2929,7 @@ static int count_esp_combs(const struct xfrm_tmpl *t) if (!aalg->pfkey_supported) continue; - if (aalg_tmpl_set(t, aalg)) + if (aalg_tmpl_set(t, aalg) && aalg->available) sz += sizeof(struct sadb_comb); } } -- 2.35.1