Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1292739ybi; Fri, 2 Aug 2019 12:48:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIr2dIora3JNFGIspqNboUVlrgIOpEy4ZoyRadt3YeQ3OBpaecTwBX4ze5sb4BrAj/kvKe X-Received: by 2002:a62:750c:: with SMTP id q12mr63134481pfc.59.1564775291916; Fri, 02 Aug 2019 12:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564775291; cv=none; d=google.com; s=arc-20160816; b=QgkDzCyRRW3p15Qx4xiBoLIXQL/HodLxPr++cfQI120m//dozi1u+A6v/tYN3UX9QX 69dIR1dvz8Ky/M9gCzQgPGua3wUVsCiHs2ruyXKAUs6EIlcvgKGl+ouulipCvv9DhZ9F EmBn8ff/QGZF5B6TI320Vb2Wm+oesHWK+GDBCazEH21orZe8QS//f5Ag5+enm0nKfQzc RjJ9MNtvStKEleW0BV5WL/KpzmCT9CJ+LR9SP7ZmTwKibt64jRwvBNYPEGlsCXWx+WLt PbmiTNcj2xaq+qyCbbmbdxNBfxpJGxovR0OMGieG9T6NWnJuYf303XrXNVkzusLEP/AF 9xiQ== 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=r3vOtWcQjDYSzVQElbF1PB/YBQ2nve3Uyr3XVps4360=; b=KwTjKuqt9jrcm2pIAxvAfvTzS04SGwZJhPCP4Nqmp+kfHKsL3JuqPaM2j/MEpTxBnU zeAiq0Mlvjxj5WcBkcJsUtUT+l7ivPoL0D3xNQZt7OGhyHtkYnsFO4t4H4/ewnF8zW11 FRTUJynTAWuB6UxAzAYDrzSwOaWbPZN7a4NuY3bPXuPy75vIK9APiSqP67/fr9xEoyo8 NZbWZM6HTv4/ftDadp+DwyftysMINBdj9ioIeC4Is9FHvsy7i/OXpKcwB93ysT3uFzJ5 q+kFaNZZFCX+D0pyHZG8H+g5CDrDV0dKQexPY9PY9lYrI7WKgAW26fcOAj/y12cJU3pS g3NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Tx+cj7in; 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 j190si41036425pge.92.2019.08.02.12.47.56; Fri, 02 Aug 2019 12:48:11 -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=Tx+cj7in; 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 S2407171AbfHBKDR (ORCPT + 99 others); Fri, 2 Aug 2019 06:03:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:43542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404702AbfHBJln (ORCPT ); Fri, 2 Aug 2019 05:41:43 -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 3F8A920880; Fri, 2 Aug 2019 09:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564738902; bh=ARtThotik/fI83JySmVBSkBR1V/J+IsDANpmGcqlpV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tx+cj7infDOy9omR17yW29FU4T4pw9cgDSekWHBdq2OSvm6HnUE08yP+cMlgqOnDA FpdTdVqNgbee0B2Q1tVHtOMQc9vq6cBkK49K7APv/qQeZuE5aQQU2SSQ3/bR0GPRkb 8EcfmuYOM57gCyXKAEMB/8JOK3S20LKImQ8ZY4LA= 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.9 040/223] xfrm: fix sa selector validation Date: Fri, 2 Aug 2019 11:34:25 +0200 Message-Id: <20190802092241.585589553@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092238.692035242@linuxfoundation.org> References: <20190802092238.692035242@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 df4b7fc721f6..f3e9d500fa5a 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