diff options
author | Florian Westphal <fw@strlen.de> | 2019-05-05 18:47:33 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-05-09 08:54:49 +0200 |
commit | 680f6af5337c98d116e4f127cea7845339dba8da (patch) | |
tree | 96319097dc1597f6995b1a8f189c61cd9fc6625e /net | |
parent | 8cd2bc981c5335cacc432cba7666c2741c3e912f (diff) | |
download | linux-stable-680f6af5337c98d116e4f127cea7845339dba8da.tar.gz linux-stable-680f6af5337c98d116e4f127cea7845339dba8da.tar.bz2 linux-stable-680f6af5337c98d116e4f127cea7845339dba8da.zip |
netfilter: ebtables: CONFIG_COMPAT: reject trailing data after last rule
If userspace provides a rule blob with trailing data after last target,
we trigger a splat, then convert ruleset to 64bit format (with trailing
data), then pass that to do_replace_finish() which then returns -EINVAL.
Erroring out right away avoids the splat plus unneeded translation and
error unwind.
Fixes: 81e675c227ec ("netfilter: ebtables: add CONFIG_COMPAT support")
Reported-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/bridge/netfilter/ebtables.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 3cad01ac64e4..3a1b94b5c0e5 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c @@ -2158,7 +2158,9 @@ static int compat_copy_entries(unsigned char *data, unsigned int size_user, if (ret < 0) return ret; - WARN_ON(size_remaining); + if (size_remaining) + return -EINVAL; + return state->buf_kern_offset; } |