Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2514105imm; Mon, 28 May 2018 09:31:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKyV8lkx0/M1Ffo5Sdn3MdAhDb2rhWt8kiEhlO3eSUyZpSj73XeRpscyAyKeuzedzu/O8gR X-Received: by 2002:a62:4141:: with SMTP id o62-v6mr1242129pfa.111.1527525061339; Mon, 28 May 2018 09:31:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527525061; cv=none; d=google.com; s=arc-20160816; b=XKxWe7/TZz60xbQ8x1gRhwKxOoOe+prGNcZ5tp+4xOKqTt+WF2/D4Ns1mnuUq3cAzP 4OXjQUKMUXRptUG7GTOVE/bj2F5Py179tUwDTAz3EevhR2mrRCurhDlplITE5M89qqRl X7iy2d7PofUVqNw5FgcE+Dwpr0G7EyurLMgk6+8imkSbIgTbpJMlxwy2duWPGbpfLYGr n2YUoKweQ6OE+jnXR6yxV4zRYLaRIjtMbLb8i4W+hNhjsp+RWW0rFFybxvXSg+nNiJaC 8KvLl+9d37elKzTW+a4ZfqFBiOO16oa3MYMIUxwzlM63i1XKgMdrNXJH1YrxwrqxHjOc UMgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=vOJULCWa16jI9hSFSSB3xmqTahpKsWWS4C8MKlm0ZZQ=; b=usZ8DoNfATW4uiTb+v50VugC/AioNFs+neIgTSHGmCmX+JP2UX7LrD2O92ioGhGA8v 2cOJd92j+Q8aPHQrepRCjPhtRXIMHp6jtQ3W35tih9T5UOI2r+nkLS14bE1/JN31xvx6 Hjy3ZkRfI4mawv5EZ/TiINivjhmw0m42pqs/CvBEh7ryzMEXrFmTM1ZYpq5mQKqHabR8 tJVejLDHPzhLbkzTAJn4pb0PeJMue6gCLg84catfMtU/faL2UKv5Idd9RWWK9iUgFAze eV7q66bvC8x3SVOvMrYD+QxUuACIplkogy1LXSCcCwWUGKoXfqtfojoMCiiHa+HXC+o1 S4IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U6j64tAZ; 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 b93-v6si30860945plb.536.2018.05.28.09.30.46; Mon, 28 May 2018 09:31:01 -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=U6j64tAZ; 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 S935759AbeE1KJs (ORCPT + 99 others); Mon, 28 May 2018 06:09:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:57860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933283AbeE1KJn (ORCPT ); Mon, 28 May 2018 06:09:43 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 779A9208AD; Mon, 28 May 2018 10:09:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527502183; bh=e5g1+cXR4XXly2aY5/a9hFy+OlwdgcTd4/Ru1E97UD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U6j64tAZB84f0ICbQCyE+ADrJLLvK9o7wtOQsrohWo5CstEJHo4g8uRz7J+Hn0Z5j KO5OEPrIiM4w5B1+6IDVVW1pJpoZIpH1SgEBMpxLw/TkwG+sRMGXO6SMEm1JcfX8kZ n4kvGuEORnuZdaaS6R9GfNbUhvmkQWY8AgX7fVyk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 3.18 092/185] netfilter: ebtables: fix erroneous reject of last rule Date: Mon, 28 May 2018 12:02:13 +0200 Message-Id: <20180528100058.592636911@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100050.700971285@linuxfoundation.org> References: <20180528100050.700971285@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Westphal [ Upstream commit 932909d9b28d27e807ff8eecb68c7748f6701628 ] The last rule in the blob has next_entry offset that is same as total size. This made "ebtables32 -A OUTPUT -d de:ad:be:ef:01:02" fail on 64 bit kernel. Fixes: b71812168571fa ("netfilter: ebtables: CONFIG_COMPAT: don't trust userland offsets") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/bridge/netfilter/ebtables.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c @@ -2086,8 +2086,12 @@ static int size_entry_mwt(struct ebt_ent * offsets are relative to beginning of struct ebt_entry (i.e., 0). */ for (i = 0; i < 4 ; ++i) { - if (offsets[i] >= *total) + if (offsets[i] > *total) return -EINVAL; + + if (i < 3 && offsets[i] == *total) + return -EINVAL; + if (i == 0) continue; if (offsets[i-1] > offsets[i])