diff options
author | Florian Westphal <fw@strlen.de> | 2018-07-11 13:45:12 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-07-18 11:26:46 +0200 |
commit | be2ab5b4d5c0bf041a34ec2e1397d50afbfb095e (patch) | |
tree | 586b1b31a05231e41d4f6fa483f0eb9078cc267f /net/netfilter/nfnetlink.c | |
parent | ca2f18be792fddd0db2bbf6cbe1ec12d1bb32dd7 (diff) | |
download | linux-be2ab5b4d5c0bf041a34ec2e1397d50afbfb095e.tar.gz linux-be2ab5b4d5c0bf041a34ec2e1397d50afbfb095e.tar.bz2 linux-be2ab5b4d5c0bf041a34ec2e1397d50afbfb095e.zip |
netfilter: nf_tables: take module reference when starting a batch
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nfnetlink.c')
-rw-r--r-- | net/netfilter/nfnetlink.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 94f9bcaa0799..dd1d7bc23b03 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c @@ -337,7 +337,14 @@ replay: return kfree_skb(skb); } + if (!try_module_get(ss->owner)) { + nfnl_unlock(subsys_id); + netlink_ack(oskb, nlh, -EOPNOTSUPP, NULL); + return kfree_skb(skb); + } + if (!ss->valid_genid(net, genid)) { + module_put(ss->owner); nfnl_unlock(subsys_id); netlink_ack(oskb, nlh, -ERESTART, NULL); return kfree_skb(skb); @@ -472,6 +479,7 @@ done: nfnl_err_reset(&err_list); nfnl_unlock(subsys_id); kfree_skb(skb); + module_put(ss->owner); goto replay; } else if (status == NFNL_BATCH_DONE) { err = ss->commit(net, oskb); @@ -491,6 +499,7 @@ done: nfnl_err_deliver(&err_list, oskb); nfnl_unlock(subsys_id); kfree_skb(skb); + module_put(ss->owner); } static const struct nla_policy nfnl_batch_policy[NFNL_BATCH_MAX + 1] = { |