Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp127371iof; Sun, 5 Jun 2022 23:10:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzKTvHXO5LKyxOQ7goMpXuX7aYyVYXtdPWYFYeNzKcPT6rbOW35XSAsW3qHz42m9+FUAUT X-Received: by 2002:a63:82c2:0:b0:3fc:ae4b:ecfc with SMTP id w185-20020a6382c2000000b003fcae4becfcmr19436299pgd.287.1654495854140; Sun, 05 Jun 2022 23:10:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654495854; cv=none; d=google.com; s=arc-20160816; b=jZ9dovdtAqAQcDq2fgZJljFyUrkHJX43S+RvJkQxbz2D4RhyRpSx/lUm/+lr/E0Utk cAAwRCn6lKtDYfRrGelzth+p9Qdbnc8uEJ9jKaet+eMWasaFtgMlvoHCkffhefRBnyDY yRhqFDYedYAtAsMBx4t9kzv6PawdApyG60N4FymvsTh0raK6xV4pEYrvoSpalof1Qceb jAx3GXFomDqEVWl5P2tNCoLxDpGt3wtqm+QxVyToA6pO9CsZQoPo+NZ4cPcK8vhnCVPD qXLOAKLRg4r1FxnumfqBQOB0xsyHHwJdrN9ZFjbMxQvj5Ec5bbNbTf2yBT3CxHpGvqmx HYgw== 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=LX7YXo3ez70UJjmlX3vvUbOsgrBNBmQYNAnpRwQEN8w=; b=Y8Z8bREYUNc8NlaFRcLSeShc/d0dkp1isU2QKWcG7qkgwX9K+4DFXj2GphYfZvV8rY fJ1f0D3jtFe3hLstlLVfkyvaayf9iYQ00psK7Ojz7rhEmiV3GdHmc16hTkZ1zPozQRXZ dbizHqbyUMlHPXGRUWjHgNSOoh/rWNYFSiRwHfygYo2LzdtuO3yTubFCPxSd3BGj77Dh qqVyaUQtRq4eJRvWABnEgZjxFrn9sIdoWk/KcZ+0ttDiV95hhLGiG7ouSg8CXS78bxHC DAttu3I+sEh1HhV7GB+j2ugX7nLQbCknAVpPJ/nIXlCGUV7PCelgGN4/6MjPe7V3I43u Tgpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J3qfsese; 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 z1-20020aa79901000000b005180f2b05b4si17663287pff.102.2022.06.05.23.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 23:10:54 -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=J3qfsese; 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 8B7E3BBCCB; Sun, 5 Jun 2022 22:02:00 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345545AbiFCRyS (ORCPT + 99 others); Fri, 3 Jun 2022 13:54:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345910AbiFCRud (ORCPT ); Fri, 3 Jun 2022 13:50:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18CD15623A; Fri, 3 Jun 2022 10:46:36 -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 5E06760A54; Fri, 3 Jun 2022 17:46:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D771C385A9; Fri, 3 Jun 2022 17:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654278394; bh=IekshAmuA1QsGwfqDVxtu1QYqOMo0gLUA/qG1zyrgHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J3qfseseDLtFeLClQimBJP5sacODXGtyU746c7lsdsTFsto9tXiharjxVxK7idFCN xPfO6FHHjjLxAByr6eWYybIruNWa3yIN1aF0zip49oYNHhOS1TKpEw3TGHu9vL2Yys st0TrCm5Zs34+HIQCrDAoh1smfvn/amvUK0U80lE= 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.10 03/53] net: af_key: check encryption module availability consistency Date: Fri, 3 Jun 2022 19:42:48 +0200 Message-Id: <20220603173818.818533060@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603173818.716010877@linuxfoundation.org> References: <20220603173818.716010877@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 61505b0df57d..6b7ed5568c09 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -2904,7 +2904,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); @@ -2922,7 +2922,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++) { @@ -2933,7 +2933,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