Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3821392ybi; Mon, 29 Jul 2019 13:16:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqysRDw0VHH5rBMHzDwHBkZwVDJeS7PYFfyk3VCcYet2qUcVMxBz6h3PdHebk6M04Jpn/DpO X-Received: by 2002:a17:90a:9b8a:: with SMTP id g10mr110998168pjp.66.1564431415715; Mon, 29 Jul 2019 13:16:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564431415; cv=none; d=google.com; s=arc-20160816; b=UjL5cfc5OPVVvc/upotJ3IKvftNVZ1vf0uk6kNF2gP9iqhMDzXNtTCtqBk/7pNHnks 89RSMCWVg3l91KdzLL+EDEKFSQKTdlpZfYZltnE4Ki8BUxot4q148wDrS0EieKszk7N8 fUbihHdrweqkX+GpY+S184CekvqEknMhiBa/V2qG28pO82JEmfTR2EnYasW7QwlV0eLb K6AdaOjFKcwxXL8cx6XC9YFLy3gw/IQcPkj8UqDZ9rCZTUeM9bErUKGg24K+fkvs0fOq TBsNDCmTnb9fAeQDX6J+EgWWn3Vj4qti0qJGDbkKETEqOXcqmL/hevsdhJSI+BD6uw5E j3ww== 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=EF8y49QxyMAm2megmnqFPorgAJyckrrs6l/vWRqErNY=; b=ZM42RhbxLj7mE03C8Ocl5fARKiUfIEbxrgOvRuZMgYmXeOzB0/3zjDv26jyggBcrHq QwmhSzGNz/FtjcQ1dQVQoigL3md0gqhUI+N7TOTT74oEDiQGzUpqLGme7DCCcWkTJxLF UAI6xUAfRZfdfnBNMAPR1gp85PeUUWMwd3dVBwBGd3iETBQ1bZkqfQQXXpnGPZ8SG6kB 7E9RFhkmVi7sztNhOecLwOrY7DykdpvLdEf9L6uQZUoQLbFKE+oDP7wgWqtl0cfVWvwX P/knXF/tkE50me7QQg1OaIgKDVKuagnF4dMUumJSwWM4A3/WHoYJveaOE41kCIG02gUe bDBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="hGr/JtjK"; 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 f8si30038523pgi.191.2019.07.29.13.16.40; Mon, 29 Jul 2019 13:16:55 -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="hGr/JtjK"; 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 S1729315AbfG2UP3 (ORCPT + 99 others); Mon, 29 Jul 2019 16:15:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:38532 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727320AbfG2T0I (ORCPT ); Mon, 29 Jul 2019 15:26:08 -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 DCB20216C8; Mon, 29 Jul 2019 19:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428367; bh=07VBAsveBrdgZ5ePYPkbGGr1G6Jm+1mfsZFXSSEGM6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hGr/JtjKKyfCaKFzGcJYmhjIaO9aitcF272uT6FHf2FkZAHzkQSLlGGAwECEhlWIA d1/JAGFxo6KodBY+ug8MO+gvgFAgR0wVXhuxdu0/l/GUijeNIi609VfncVMZDfX5cu kjAlGInEHxH78dY/rJV9Uf2tbuqH8RFoLxAV2QTE= 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.14 052/293] xfrm: fix sa selector validation Date: Mon, 29 Jul 2019 21:19:03 +0200 Message-Id: <20190729190827.685603526@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 b25b68ae7c74..150c58dc8a7b 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