Commit 89370860 authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

netfilter: x_tables: make sure compat af mutex is held

Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 7d7d7e02
...@@ -582,6 +582,8 @@ int xt_compat_add_offset(u_int8_t af, unsigned int offset, int delta) ...@@ -582,6 +582,8 @@ int xt_compat_add_offset(u_int8_t af, unsigned int offset, int delta)
{ {
struct xt_af *xp = &xt[af]; struct xt_af *xp = &xt[af];
WARN_ON(!mutex_is_locked(&xt[af].compat_mutex));
if (WARN_ON(!xp->compat_tab)) if (WARN_ON(!xp->compat_tab))
return -ENOMEM; return -ENOMEM;
...@@ -599,6 +601,8 @@ EXPORT_SYMBOL_GPL(xt_compat_add_offset); ...@@ -599,6 +601,8 @@ EXPORT_SYMBOL_GPL(xt_compat_add_offset);
void xt_compat_flush_offsets(u_int8_t af) void xt_compat_flush_offsets(u_int8_t af)
{ {
WARN_ON(!mutex_is_locked(&xt[af].compat_mutex));
if (xt[af].compat_tab) { if (xt[af].compat_tab) {
vfree(xt[af].compat_tab); vfree(xt[af].compat_tab);
xt[af].compat_tab = NULL; xt[af].compat_tab = NULL;
...@@ -630,6 +634,8 @@ int xt_compat_init_offsets(u8 af, unsigned int number) ...@@ -630,6 +634,8 @@ int xt_compat_init_offsets(u8 af, unsigned int number)
{ {
size_t mem; size_t mem;
WARN_ON(!mutex_is_locked(&xt[af].compat_mutex));
if (!number || number > (INT_MAX / sizeof(struct compat_delta))) if (!number || number > (INT_MAX / sizeof(struct compat_delta)))
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment