Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2514929imm; Thu, 7 Jun 2018 11:58:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKrGasFTUrBeaFRyjZNxQQ/MVKxbPpscFD1DFad8tC0cHk9+fFVc+grbOjr9HYFDhXQoLL0 X-Received: by 2002:a65:5003:: with SMTP id f3-v6mr2537446pgo.425.1528397932781; Thu, 07 Jun 2018 11:58:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528397932; cv=none; d=google.com; s=arc-20160816; b=NxPDE8xBfnWlmwXM9GkcWKGiNSJxm0vNGkpNf9Qh+x2Q47RHOpjCPqkTtFPtYfamJa fr2cBsh8f4jkelksFemXdTS3lNj1YHLTrag/UNVYP40u1616eZE5pjtErkzEDhbml/9U TRJIgF2F2JAHLkLnqHc1GnB0mEIkfgkz4ECcyxwe7j09UuYV+lF8lK77BvtvNiv6PQGv BU/hnybQSwkUl6BMjXFhHpGMrS3QQTXVhA6MXrNHxTEoN4QkjVoOz780nre5y2IDfypN R8d4EY1vuzBEaE+HKqyoCwGwNzXzPs9UsY+ycrYGBxTAjPwcPBY3/geZ8ZvEoM3rJp/l 1e2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=v46pYDds4Q6ThZPW8hkse3Fte7s3jKTPbMChKkMSFDw=; b=khXe12Z9TEDWnUmGpd/SPKIHmBOeLjOxy7IMheUeZgke8O0UsUH1wJrUfm9ISJJjaL i6VBMVscNQ6JkZzQ47+n8aPQ24Y3JecPMPWx3Ta8akONRDfC/71gocnJxqWNuz1ZhboT /zsitzrjBYPc/cOpAsaQBQHblhKKncDhz7ayXdvLddgRHsGl35mnqHutz3nd26+Jyy4l l1lGxUY23mqQgtZsC05Zk/ADA8ocwUFijc/AUq36zI+fKKAJkF9n/uK67NpwqOq5nGW9 YsnI3q6scGNr70qHYJwrY8tRZ2opdTXeLbwr0RSNbwkiYvS+VbQQduFmVlv67vYeLNTF 2Yvw== ARC-Authentication-Results: i=1; mx.google.com; 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 k12-v6si30973427pll.319.2018.06.07.11.58.38; Thu, 07 Jun 2018 11:58:52 -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; 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 S935427AbeFGQPe (ORCPT + 99 others); Thu, 7 Jun 2018 12:15:34 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39116 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932902AbeFGOI6 (ORCPT ); Thu, 7 Jun 2018 10:08:58 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvay-0005Zy-GC; Thu, 07 Jun 2018 15:08:56 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvax-0002hJ-IG; Thu, 07 Jun 2018 15:08:55 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Florian Westphal" , "Pablo Neira Ayuso" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 016/410] netfilter: ebtables: fix erroneous reject of last rule In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Florian Westphal commit 932909d9b28d27e807ff8eecb68c7748f6701628 upstream. 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: Ben Hutchings --- 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 @@ -2070,8 +2070,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])