Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10527838ybi; Thu, 25 Jul 2019 00:57:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIVxMtUc+5VujYwrObFL4rbPo6aVKQs3YKnWRxPi1JgDOTcyApOUM7mjZymBJ1CeZnirpg X-Received: by 2002:a17:902:a40c:: with SMTP id p12mr89660828plq.146.1564041439468; Thu, 25 Jul 2019 00:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564041439; cv=none; d=google.com; s=arc-20160816; b=PxYkBa4eCYzUSacm7kFwR7F72xGFyqgCJcfRoaMrw+KjKzknZilgnnkmPBPXd2bezZ NJ20N3DS/CuuKA1Gjauyl65Uc/YcloG/JIRZHwreQklW9/QbRk1YXSteRNIKNkoFuMlG yDdpOnrJTk+qu3Dh9HLE4+otF6llBqvq7QKdf7pW7b7PQM4mCS6Q1GTdAu79zoNPNVEI ItsriDCG5ziu2O2NNgueBU87fu5Z91ubQt0zDGkYuubzuU7l1qNqxdn/qxwRdabBVSEO SlpI2TTXJAirPM4Z2NP8PM+A+4y0KXd7gNfh/RkDT95doX1Y7ooqkyqC6+l5QfWMWUIh 1XHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DlqSVjpJJtUAJs/dkC8alN+dCj0ZXDFgtw8aS8sGkL4=; b=rDUXQoQDXdIl8iAWBJ+pJL2ByCNncNQzb06TXHUwSkaJDNetwYrsDl01lrSwrbIFml HtSOWr47Qq8qFMPP60gWETZO3G2JYbEBH07Nkm2XcECckA+moYWdZsrsFiRAgsQAduyZ roJwnbJk/tPHCYKrj5ha2obOsVvbFVRRDIaqRgr7ULFDdqkVWCxt4n/jZs2cfURbEInn TaVX0GcwjVMDrE/pv7Mi51EGCqlm2sMazHCzX2ySoCpIDDeV6ql0HdDR5rWQsuPuF7J/ zjN8CQVEE5C3LaDOrsZxulXeMUVzOqNl7gPHSpQ8aTRyey9+vzQl+Ck80D7df7V8zAZQ si0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SMlJuFWQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10si15166447plg.320.2019.07.25.00.57.01; Thu, 25 Jul 2019 00:57:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SMlJuFWQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405054AbfGXUEp (ORCPT + 99 others); Wed, 24 Jul 2019 16:04:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:55796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392567AbfGXUEg (ORCPT ); Wed, 24 Jul 2019 16:04:36 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0F19E205C9; Wed, 24 Jul 2019 20:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563998676; bh=dkRZBDZPap36RShbRBG/Q4a5iAVbQAwRTZqiZMgSREg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SMlJuFWQol/q/xfP4ke5Q8DLjuv4rf8Pde81gQbtMsqo+yYJhcKP2q13K02p44lyE 4aLgRUbXvQSfoCoZ0QkHHFNb3hz8O+2UxdFt+vaFCNQqwlM7nWLIbYl4WB5cPyVG97 s846z7JqYVayOhMJ0mCna3yJy3oZtWF7xt3IPjYw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anirudh Gupta , Nicolas Dichtel , Herbert Xu , Steffen Klassert , Sasha Levin Subject: [PATCH 4.19 075/271] xfrm: fix sa selector validation Date: Wed, 24 Jul 2019 21:19:04 +0200 Message-Id: <20190724191701.610520399@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit b8d6d0079757cbd1b69724cfd1c08e2171c68cee ] After commit b38ff4075a80, the following command does not work anymore: $ ip xfrm state add src 10.125.0.2 dst 10.125.0.1 proto esp spi 34 reqid 1 \ mode tunnel enc 'cbc(aes)' 0xb0abdba8b782ad9d364ec81e3a7d82a1 auth-trunc \ 'hmac(sha1)' 0xe26609ebd00acb6a4d51fca13e49ea78a72c73e6 96 flag align4 In fact, the selector is not mandatory, allow the user to provide an empty selector. Fixes: b38ff4075a80 ("xfrm: Fix xfrm sel prefix length validation") CC: Anirudh Gupta Signed-off-by: Nicolas Dichtel Acked-by: Herbert Xu Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- net/xfrm/xfrm_user.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index d80d54e663c0..1484bc99a537 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -166,6 +166,9 @@ static int verify_newsa_info(struct xfrm_usersa_info *p, } switch (p->sel.family) { + case AF_UNSPEC: + break; + case AF_INET: if (p->sel.prefixlen_d > 32 || p->sel.prefixlen_s > 32) goto out; -- 2.20.1