netfilter: x_tables: validate all offsets and sizes in a rule
authorFlorian Westphal <fw@strlen.de>
Fri, 1 Apr 2016 12:17:29 +0000 (14:17 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Jun 2016 17:18:23 +0000 (10:18 -0700)
commitcaa39a1e709c3cf89c0a4d600e98f9863085e3d5
treef21ee379a64d8ad12edd80c2b102916d4a1b8b37
parent8a865621540c7bc7f03665a2b7029cb444a9593a
netfilter: x_tables: validate all offsets and sizes in a rule

commit 13631bfc604161a9d69cd68991dff8603edd66f9 upstream.

Validate that all matches (if any) add up to the beginning of
the target and that each match covers at least the base structure size.

The compat path should be able to safely re-use the function
as the structures only differ in alignment; added a
BUILD_BUG_ON just in case we have an arch that adds padding as well.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/x_tables.c