Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1406330pxp; Thu, 17 Mar 2022 08:45:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbfe4DyARUdjAsRsJ8dG+xviO99Y/AA9K+lS3G4X1OT47WnhIkS0ramx8LI6urWWVM8vJ3 X-Received: by 2002:aa7:cb8b:0:b0:410:9aaf:2974 with SMTP id r11-20020aa7cb8b000000b004109aaf2974mr5114706edt.173.1647531946722; Thu, 17 Mar 2022 08:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647531946; cv=none; d=google.com; s=arc-20160816; b=Lnq+1vH/v72Hhuxbimw6/irUrQU6dYmVssNCDHg1mNOCtnrfumS8bxNLEhb1xauyGS 55QsW5j3NlmZPLyP/9aFqy86HntrRas1nb57aYANxlC6sUq6jEkHd/SFJfoq/kdkgtms qKUcG+ac0RUv/Dlx27gTlYjuVTHpXwUITusGOvZujEGDlM8LMjbngSuQWlPaoIibBN7o hh/I/yL1V6AdCVRvj7mEMDuZKgessz51WEx956PgqXvUJDaF8Ol7N0wH+jwCPCpoo86w jDU0pxz+SIFsKqyqMZbdMfYcKtQVId6Ut+SdRGo7WcEWkmuOK75XEUs6HePseB2MWf4t pfvw== 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=j34w66//SsKrxJx5j7UPYTN9R38lJuGZzNGacNUilWc=; b=HbCtmIAjp+Zm6p1zigZ5AV6eVpa+gEX6iW2OHVjlNsvpjp685lUb/rBxk/GspO9RL7 uBaPuCpUGaPTg/NJlB+Cpc7K6jzik4no5jIPAf/eLKpH8gG009uTAcgkVobqXwbwkQVM lYeNRAotatUvo3WAAebSeiGMKANKOgyXg168qNrXtf1DbKGIRJUdyp5ePg257b95tUJF I7OL0pXhSXiUbh2ZOwf1VuBVkJCMOvMCaVLLJTkdg4bUJXIRlcxdXMZxzvI6y4knnO3Y rtbVqCKCeTb16zgmeQ/gme5qwc5bQsKTFdaptIG99iG2Nui6JkHo5jGXk5ujOiICFq45 zbPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xu7C0RH3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wi16-20020a170906fd5000b006df8b7b49a5si1859955ejb.999.2022.03.17.08.45.20; Thu, 17 Mar 2022 08:45:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=xu7C0RH3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233679AbiCQMr5 (ORCPT + 99 others); Thu, 17 Mar 2022 08:47:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233678AbiCQMrw (ORCPT ); Thu, 17 Mar 2022 08:47:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EFDB12223B; Thu, 17 Mar 2022 05: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 F33656124B; Thu, 17 Mar 2022 12:46:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5E14C340E9; Thu, 17 Mar 2022 12:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647521195; bh=xPAcPPJ50ONHzDAW0yAHWghTy3kIpEpvRsviX4k9V2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xu7C0RH3M2oQO/fPSyWEsqbqngUegRnaWd8bcDWjpv6pcrpvwtX+p8K/cckObcJL0 swOgwanfbbYRdJTSx0hqP/1OcfXTMsmX20oeeTQL/mFFFNQKabXBKjbHvsy9/Y2f2Y 9wOpTlveGy8QTkRhmtNVUVfNXB3KKC5PupBRtHq4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Lueke , Steffen Klassert Subject: [PATCH 5.4 01/43] Revert "xfrm: state and policy should fail if XFRMA_IF_ID 0" Date: Thu, 17 Mar 2022 13:45:12 +0100 Message-Id: <20220317124527.716217551@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220317124527.672236844@linuxfoundation.org> References: <20220317124527.672236844@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-kernel@vger.kernel.org From: Kai Lueke commit a3d9001b4e287fc043e5539d03d71a32ab114bcb upstream. This reverts commit 68ac0f3810e76a853b5f7b90601a05c3048b8b54 because ID 0 was meant to be used for configuring the policy/state without matching for a specific interface (e.g., Cilium is affected, see https://github.com/cilium/cilium/pull/18789 and https://github.com/cilium/cilium/pull/19019). Signed-off-by: Kai Lueke Signed-off-by: Steffen Klassert Signed-off-by: Greg Kroah-Hartman --- net/xfrm/xfrm_user.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -621,13 +621,8 @@ static struct xfrm_state *xfrm_state_con xfrm_smark_init(attrs, &x->props.smark); - if (attrs[XFRMA_IF_ID]) { + if (attrs[XFRMA_IF_ID]) x->if_id = nla_get_u32(attrs[XFRMA_IF_ID]); - if (!x->if_id) { - err = -EINVAL; - goto error; - } - } err = __xfrm_init_state(x, false, attrs[XFRMA_OFFLOAD_DEV]); if (err) @@ -1333,13 +1328,8 @@ static int xfrm_alloc_userspi(struct sk_ mark = xfrm_mark_get(attrs, &m); - if (attrs[XFRMA_IF_ID]) { + if (attrs[XFRMA_IF_ID]) if_id = nla_get_u32(attrs[XFRMA_IF_ID]); - if (!if_id) { - err = -EINVAL; - goto out_noput; - } - } if (p->info.seq) { x = xfrm_find_acq_byseq(net, mark, p->info.seq); @@ -1641,13 +1631,8 @@ static struct xfrm_policy *xfrm_policy_c xfrm_mark_get(attrs, &xp->mark); - if (attrs[XFRMA_IF_ID]) { + if (attrs[XFRMA_IF_ID]) xp->if_id = nla_get_u32(attrs[XFRMA_IF_ID]); - if (!xp->if_id) { - err = -EINVAL; - goto error; - } - } return xp; error: