diff options
author | Florian Westphal <fw@strlen.de> | 2016-08-30 00:35:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-15 08:27:50 +0200 |
commit | 61610c63fa1025468c82be975e7d574e847d00de (patch) | |
tree | a2ac4cc22ca7ae257d3de4516dfbecb175a75fa5 /net | |
parent | b54698f045e805b577e14285d047ecfae1e706be (diff) |
netfilter: x_tables: check for size overflow
[ Upstream commit d157bd761585605b7882935ffb86286919f62ea1 ]
Ben Hawkes says:
integer overflow in xt_alloc_table_info, which on 32-bit systems can
lead to small structure allocation and a copy_from_user based heap
corruption.
Reported-by: Ben Hawkes <hawkes@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/x_tables.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index c7b7cecb5bd1..2fc6ca9d1286 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -900,6 +900,9 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size) if (sz < sizeof(*info)) return NULL; + if (sz < sizeof(*info)) + return NULL; + /* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */ if ((SMP_ALIGN(size) >> PAGE_SHIFT) + 2 > totalram_pages) return NULL; |