From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C5C4C7618F for ; Wed, 24 Jul 2019 20:04:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6916321855 for ; Wed, 24 Jul 2019 20:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563998682; bh=dkRZBDZPap36RShbRBG/Q4a5iAVbQAwRTZqiZMgSREg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=YOfZp3VGVOrNJ3Cyk+cdrMEkKo3t3QE+WLKsf2qkztbMcoZZEHcbO0a0ArNWUDdPM B6mrwnuWaRimEGCoRHtKEyQLB+qf3RyN2X72s9lZTwgLk8pleIeH6Ru3a+i6RcVpmv /Zev3Z/qaNqummf28G7INuKcRPeG+ER0B7SacEv4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392580AbfGXUEl (ORCPT ); Wed, 24 Jul 2019 16:04:41 -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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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