Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp134136iof; Sun, 5 Jun 2022 23:22:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO7bmPx8XZFyhdEFip0ubZIs99UCWxwGtABbQgSx0QeaYkBXHookUlKgMtfTzB/zix6TzM X-Received: by 2002:a63:2cd8:0:b0:3fd:2121:aceb with SMTP id s207-20020a632cd8000000b003fd2121acebmr14334004pgs.173.1654496566403; Sun, 05 Jun 2022 23:22:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654496566; cv=none; d=google.com; s=arc-20160816; b=Dpk10G31eiq8yv1jNcDuHLVeqWGKehwuCbfJVpFg61uIZ+SD+6RqeFid4knPhcRmms QNv+K0ztI2AOHMDNv9zjqM9Mn+gYh6YRXI3o2GiWmx0Amn2zX75Ln5Btynqt5o6TGNuT y5RpPu4jXzAWtesH9YK/efrdGQEu5mJJknuqtUXxZxMoZ1ZdAc+rKI3nC/zyRirV19dQ XAnTgxyDs8ZLSFZygrgp6pzWzzcpM0YEbZ3nQyJ+LeWzS7uqnN1Eu4ERoMbANxzIiGiS QAlaMxFZu4T4VUpQ4Njqrh9WMunk8h6oktkWFgN/YC5sGLKCuJF4rvBBj8SCj9cMkN4g Qr6A== 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=7K4Zu4r6CC+xGiURNT9hLuV9pYrxc5aaINtXleoBY5s=; b=M4XSXBLOaxqOF6XiTzHhoEXwe4kZ6vq0BOXl/itaqtmA3NAKV6IKguPhuDwsh3hd/h o1nxOeixDHb27EQP8HC1W633feuFTc06q74ctRlWrU5oKlSmKbiiWybfyCUyMskfqw5/ 0kJkGTth3kWmUepS6neAmTAllulYDlIN8WnkIhmPnrJ1HxW90TxiHZ4Ftmw5E9ez6FOI 2gEvPgqmj8GZu0IKCjocUSQFjVTCLzvJcyTi5R+liqEfoloi6esHi/aTEtAdcJ80l9pV IKvwiogaSEKw2t3zt2TIBqzJE4xpBgw/WXb/0MpAJGNBlC3Ax+1KIlK+uFCjoE4KfCTB 4/EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dOmZjO8a; 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 w79-20020a627b52000000b005189da5244csi18914976pfc.330.2022.06.05.23.22.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 23:22:46 -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=dOmZjO8a; 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 CCFB02A40D; Sun, 5 Jun 2022 22:02:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345921AbiFCR7A (ORCPT + 99 others); Fri, 3 Jun 2022 13:59:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344991AbiFCRs4 (ORCPT ); Fri, 3 Jun 2022 13:48:56 -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 5076855359; Fri, 3 Jun 2022 10:45:45 -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 B52A260C47; Fri, 3 Jun 2022 17:45:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6F31C385B8; Fri, 3 Jun 2022 17:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654278344; bh=MFTKNe6w2Me8NT2WM3LGHJPXBnG8b7aPudi9BrSnwjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dOmZjO8aPE0znGPYM0Q2rtcySQnxnW/bYxYjEpzWmZsLMhk3QqXmNHpj0wP4LZ2fB wgzjeWiCJnHcleEcUQLxhxHxQfisByeTatY9IpvNEyeissxv/X2sIUvnKcfx2wrkgc n66ywdmLk8/Vs+gPjNTeJYRZeh0C5gfxw1P/3kOw= 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.4 12/34] net: af_key: check encryption module availability consistency Date: Fri, 3 Jun 2022 19:43:08 +0200 Message-Id: <20220603173816.353260373@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603173815.990072516@linuxfoundation.org> References: <20220603173815.990072516@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 f67d3ba72c49..dd064d5eff6e 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