]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
netfilter: ebtables: CONFIG_COMPAT: reject trailing data after last rule
authorFlorian Westphal <fw@strlen.de>
Sun, 5 May 2019 16:47:33 +0000 (18:47 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
BugLink: https://bugs.launchpad.net/bugs/1863019
[ Upstream commit 680f6af5337c98d116e4f127cea7845339dba8da ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/bridge/netfilter/ebtables.c

index d728b61644eab24cac75d13a2cfbd40c803155e0..d4b33af6b5303aff734f0dc09d4f0ae340ea98ea 100644 (file)
@@ -2163,7 +2163,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;
 }