Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2299381pxp; Mon, 21 Mar 2022 16:15:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy29/rHpT8x4tpv1ZH2d2cVY37Bm3uKO1rBzLgAPNIVj3/TfMCsMPjFyx1dmsxwwa0gh+TZ X-Received: by 2002:a17:902:9a4b:b0:14f:fe0b:5546 with SMTP id x11-20020a1709029a4b00b0014ffe0b5546mr15150517plv.46.1647904549123; Mon, 21 Mar 2022 16:15:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647904549; cv=none; d=google.com; s=arc-20160816; b=eXxWjTvpdyT7VrY/F3eqeyWL/Vqum+V8W3hcBngruWvi/l+UeR++EJSRZAMq4GeSAH AVp0MsufnQFAfeboY7CN2YhAmBNbiSU7RCMQV00y7h/jRK3StIn16ydJyiNc55Ka6DaM aWynNwXWxoxvvJwaPnwCSIxhMMoAIGlPDohTVrRK3djbPOdpTdrDYcg1/535+PR0N+T2 AJUsFXxddzd32BJT94HcfbsCGhC+P6vX5HrwWKKO5F7lTE/7akImFJQpPAyZFCkk4N1B 8fPKWozGh1pnyxDZ5ZdvaaBjhj0pieMxyUWIDkzdi9/66ro602cb3aSwEtGm3YX5FqEc Xn7A== 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=Nz02Fs0T2LsQj6NJg2t3NOnEHPxzsjI83obtgRP1Vg0=; b=pSvU0TswprVvDh1CvVdUJuMi1m5Na7O0FcrHSpaUMkCQ/w0xbqC3DIHnU28QzI5Jk1 9vahBse01Tuj6jheTMCygeQmiHPPJSxO89/DI3fx0aXF8ids691x7hlKHpms8wEo1bIJ Pzz4V3bzjcX203jHd+Sjgat5K9H/LsvmIwS3yzVCW8eRHcw53A+A15kkT1IPtDrIeDFy sLdHPFaVXvOe8nDYW4hQ3RH+nJBg97hE4xLgzsybVSk21ubHw7oNKDOXbemvXAQ6/e7B pGgNQlnkVv8KBFEFtikr5DCN0rpJNrqVK9UgSkmkm3NjbwSlzVgOCYosOXg8ug2e4Geh ATyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JwoUBJZB; 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 g13-20020a63b14d000000b003816043f0cesi15628415pgp.707.2022.03.21.16.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:15:49 -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=JwoUBJZB; 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 116D243F8EA; Mon, 21 Mar 2022 15:12:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348448AbiCUN5x (ORCPT + 99 others); Mon, 21 Mar 2022 09:57:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348332AbiCUN4c (ORCPT ); Mon, 21 Mar 2022 09:56:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB90316F06E; Mon, 21 Mar 2022 06:54:58 -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 ams.source.kernel.org (Postfix) with ESMTPS id 28B00B81644; Mon, 21 Mar 2022 13:54:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B6A4C340E8; Mon, 21 Mar 2022 13:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647870895; bh=wRlbELFcSaNKD9S2F10d7gbg4M2/MDxgsTY8gQvkjOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JwoUBJZBlQL4uf5Zk5YJ+Dos/CzvSGY9UGnoICiS0X4u1xs4UCBVY/XJZj+z1qrCz BfAL9ZBICIKcfKWLQd4gYLpIPkZQKX0OBQ5bbKCt7555wWQ+E1OS8wMjLXT+8Jve29 jJYxkJ/Qu2wtN+4Xg5LrwdLxy9aX4V1ko/Ltxosg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Lueke , Steffen Klassert Subject: [PATCH 4.19 01/57] Revert "xfrm: state and policy should fail if XFRMA_IF_ID 0" Date: Mon, 21 Mar 2022 14:51:42 +0100 Message-Id: <20220321133222.028331018@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133221.984120927@linuxfoundation.org> References: <20220321133221.984120927@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=-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: 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 @@ -620,13 +620,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) @@ -1332,13 +1327,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); @@ -1640,13 +1630,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: