Skip to content

Commit

Permalink
netfilter: ebtables: fix erroneous reject of last rule
Browse files Browse the repository at this point in the history
[ Upstream commit 932909d ]

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: b718121 ("netfilter: ebtables: CONFIG_COMPAT: don't trust userland offsets")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Florian Westphal authored and Greg Kroah-Hartman committed May 30, 2018
1 parent e2cad74 commit 5d76473
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/bridge/netfilter/ebtables.c
Original file line number Diff line number Diff line change
Expand Up @@ -2086,8 +2086,12 @@ static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base,
* 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])
Expand Down

0 comments on commit 5d76473

Please sign in to comment.