netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf] netfilter: ebtables: CONFIG_COMPAT: reject trailing data after last rule
@ 2019-05-05 16:47 Florian Westphal
  2019-05-09  6:54 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2019-05-05 16:47 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal, Tetsuo Handa

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>
---
 net/bridge/netfilter/ebtables.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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;
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH nf] netfilter: ebtables: CONFIG_COMPAT: reject trailing data after last rule
  2019-05-05 16:47 [PATCH nf] netfilter: ebtables: CONFIG_COMPAT: reject trailing data after last rule Florian Westphal
@ 2019-05-09  6:54 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2019-05-09  6:54 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel, Tetsuo Handa

On Sun, May 05, 2019 at 06:47:33PM +0200, Florian Westphal wrote:
> 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,

Applied, thanks Florian.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-09  6:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-05 16:47 [PATCH nf] netfilter: ebtables: CONFIG_COMPAT: reject trailing data after last rule Florian Westphal
2019-05-09  6:54 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).