aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2015-02-12 16:15:31 -0500
committerPablo Neira Ayuso <pablo@netfilter.org>2015-02-16 11:00:36 -0500
commit520aa7414bb590f39d0d1591b06018e60cbc7cf4 (patch)
treedd9877a683f1bb1350651174e1352016fcac41dd /net
parentdd3733b3e798daf778a1ec08557f388f00fdc2f6 (diff)
netfilter: nft_compat: fix module refcount underflow
Feb 12 18:20:42 nfdev kernel: ------------[ cut here ]------------ Feb 12 18:20:42 nfdev kernel: WARNING: CPU: 4 PID: 4359 at kernel/module.c:963 module_put+0x9b/0xba() Feb 12 18:20:42 nfdev kernel: CPU: 4 PID: 4359 Comm: ebtables-compat Tainted: G W 3.19.0-rc6+ #43 [...] Feb 12 18:20:42 nfdev kernel: Call Trace: Feb 12 18:20:42 nfdev kernel: [<ffffffff815fd911>] dump_stack+0x4c/0x65 Feb 12 18:20:42 nfdev kernel: [<ffffffff8103e6f7>] warn_slowpath_common+0x9c/0xb6 Feb 12 18:20:42 nfdev kernel: [<ffffffff8109919f>] ? module_put+0x9b/0xba Feb 12 18:20:42 nfdev kernel: [<ffffffff8103e726>] warn_slowpath_null+0x15/0x17 Feb 12 18:20:42 nfdev kernel: [<ffffffff8109919f>] module_put+0x9b/0xba Feb 12 18:20:42 nfdev kernel: [<ffffffff813ecf7c>] nft_match_destroy+0x45/0x4c Feb 12 18:20:42 nfdev kernel: [<ffffffff813e683f>] nf_tables_rule_destroy+0x28/0x70 Reported-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Tested-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nft_compat.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c
index 265e190f2218..b6364869c2e0 100644
--- a/net/netfilter/nft_compat.c
+++ b/net/netfilter/nft_compat.c
@@ -578,8 +578,12 @@ nft_match_select_ops(const struct nft_ctx *ctx,
578 struct xt_match *match = nft_match->ops.data; 578 struct xt_match *match = nft_match->ops.data;
579 579
580 if (strcmp(match->name, mt_name) == 0 && 580 if (strcmp(match->name, mt_name) == 0 &&
581 match->revision == rev && match->family == family) 581 match->revision == rev && match->family == family) {
582 if (!try_module_get(match->me))
583 return ERR_PTR(-ENOENT);
584
582 return &nft_match->ops; 585 return &nft_match->ops;
586 }
583 } 587 }
584 588
585 match = xt_request_find_match(family, mt_name, rev); 589 match = xt_request_find_match(family, mt_name, rev);
@@ -648,8 +652,12 @@ nft_target_select_ops(const struct nft_ctx *ctx,
648 struct xt_target *target = nft_target->ops.data; 652 struct xt_target *target = nft_target->ops.data;
649 653
650 if (strcmp(target->name, tg_name) == 0 && 654 if (strcmp(target->name, tg_name) == 0 &&
651 target->revision == rev && target->family == family) 655 target->revision == rev && target->family == family) {
656 if (!try_module_get(target->me))
657 return ERR_PTR(-ENOENT);
658
652 return &nft_target->ops; 659 return &nft_target->ops;
660 }
653 } 661 }
654 662
655 target = xt_request_find_target(family, tg_name, rev); 663 target = xt_request_find_target(family, tg_name, rev);