Skip to content

Commit 8937086

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: x_tables: make sure compat af mutex is held
Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 7d7d7e0 commit 8937086

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/netfilter/x_tables.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,8 @@ int xt_compat_add_offset(u_int8_t af, unsigned int offset, int delta)
582582
{
583583
struct xt_af *xp = &xt[af];
584584

585+
WARN_ON(!mutex_is_locked(&xt[af].compat_mutex));
586+
585587
if (WARN_ON(!xp->compat_tab))
586588
return -ENOMEM;
587589

@@ -599,6 +601,8 @@ EXPORT_SYMBOL_GPL(xt_compat_add_offset);
599601

600602
void xt_compat_flush_offsets(u_int8_t af)
601603
{
604+
WARN_ON(!mutex_is_locked(&xt[af].compat_mutex));
605+
602606
if (xt[af].compat_tab) {
603607
vfree(xt[af].compat_tab);
604608
xt[af].compat_tab = NULL;
@@ -630,6 +634,8 @@ int xt_compat_init_offsets(u8 af, unsigned int number)
630634
{
631635
size_t mem;
632636

637+
WARN_ON(!mutex_is_locked(&xt[af].compat_mutex));
638+
633639
if (!number || number > (INT_MAX / sizeof(struct compat_delta)))
634640
return -EINVAL;
635641

0 commit comments

Comments
 (0)