Skip to content

Commit b184356

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: conntrack: remove module owner field
No need to get/put module owner reference, none of these can be removed anymore. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 197c430 commit b184356

File tree

5 files changed

+0
-21
lines changed

5 files changed

+0
-21
lines changed

include/net/netfilter/nf_conntrack_l4proto.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ struct nf_conntrack_l4proto {
7474

7575
/* Return the per-net protocol part. */
7676
struct nf_proto_net *(*get_net_proto)(struct net *net);
77-
78-
/* Module (if any) which this is connected to. */
79-
struct module *me;
8077
};
8178

8279
bool icmp_pkt_to_tuple(const struct sk_buff *skb,
@@ -148,7 +145,6 @@ extern const struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
148145
const struct nf_conntrack_l4proto *__nf_ct_l4proto_find(u8 l4proto);
149146

150147
const struct nf_conntrack_l4proto *nf_ct_l4proto_find_get(u8 l4proto);
151-
void nf_ct_l4proto_put(const struct nf_conntrack_l4proto *p);
152148

153149
/* Protocol pernet registration. */
154150
int nf_ct_l4proto_pernet_register_one(struct net *net,

net/netfilter/nf_conntrack_proto.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,12 @@ const struct nf_conntrack_l4proto *nf_ct_l4proto_find_get(u8 l4num)
139139

140140
rcu_read_lock();
141141
p = __nf_ct_l4proto_find(l4num);
142-
if (!try_module_get(p->me))
143-
p = &nf_conntrack_l4proto_generic;
144142
rcu_read_unlock();
145143

146144
return p;
147145
}
148146
EXPORT_SYMBOL_GPL(nf_ct_l4proto_find_get);
149147

150-
void nf_ct_l4proto_put(const struct nf_conntrack_l4proto *p)
151-
{
152-
module_put(p->me);
153-
}
154-
EXPORT_SYMBOL_GPL(nf_ct_l4proto_put);
155-
156148
static int kill_l4proto(struct nf_conn *i, void *data)
157149
{
158150
const struct nf_conntrack_l4proto *l4proto;

net/netfilter/nf_conntrack_proto_gre.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ const struct nf_conntrack_l4proto nf_conntrack_l4proto_gre = {
373373
#endif
374374
.packet = gre_packet,
375375
.destroy = gre_destroy,
376-
.me = THIS_MODULE,
377376
#if IS_ENABLED(CONFIG_NF_CT_NETLINK)
378377
.tuple_to_nlattr = nf_ct_port_tuple_to_nlattr,
379378
.nlattr_tuple_size = nf_ct_port_nlattr_tuple_size,

net/netfilter/nfnetlink_cttimeout.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ static int cttimeout_new_timeout(struct net *net, struct sock *ctnl,
152152
err:
153153
kfree(timeout);
154154
err_proto_put:
155-
nf_ct_l4proto_put(l4proto);
156155
return ret;
157156
}
158157

@@ -302,7 +301,6 @@ static int ctnl_timeout_try_del(struct net *net, struct ctnl_timeout *timeout)
302301
if (refcount_dec_if_one(&timeout->refcnt)) {
303302
/* We are protected by nfnl mutex. */
304303
list_del_rcu(&timeout->head);
305-
nf_ct_l4proto_put(timeout->timeout.l4proto);
306304
nf_ct_untimeout(net, &timeout->timeout);
307305
kfree_rcu(timeout, rcu_head);
308306
} else {
@@ -372,10 +370,8 @@ static int cttimeout_default_set(struct net *net, struct sock *ctnl,
372370
if (ret < 0)
373371
goto err;
374372

375-
nf_ct_l4proto_put(l4proto);
376373
return 0;
377374
err:
378-
nf_ct_l4proto_put(l4proto);
379375
return ret;
380376
}
381377

@@ -511,7 +507,6 @@ static int cttimeout_default_get(struct net *net, struct sock *ctnl,
511507
/* this avoids a loop in nfnetlink. */
512508
return ret == -EAGAIN ? -ENOBUFS : ret;
513509
err:
514-
nf_ct_l4proto_put(l4proto);
515510
return err;
516511
}
517512

@@ -592,7 +587,6 @@ static void __net_exit cttimeout_net_exit(struct net *net)
592587

593588
list_for_each_entry_safe(cur, tmp, &net->nfct_timeout_list, head) {
594589
list_del_rcu(&cur->head);
595-
nf_ct_l4proto_put(cur->timeout.l4proto);
596590

597591
if (refcount_dec_and_test(&cur->refcnt))
598592
kfree_rcu(cur, rcu_head);

net/netfilter/nft_ct.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,6 @@ static int nft_ct_timeout_obj_init(const struct nft_ctx *ctx,
902902
err_free_timeout:
903903
kfree(timeout);
904904
err_proto_put:
905-
nf_ct_l4proto_put(l4proto);
906905
return ret;
907906
}
908907

@@ -913,7 +912,6 @@ static void nft_ct_timeout_obj_destroy(const struct nft_ctx *ctx,
913912
struct nf_ct_timeout *timeout = priv->timeout;
914913

915914
nf_ct_untimeout(ctx->net, timeout);
916-
nf_ct_l4proto_put(timeout->l4proto);
917915
nf_ct_netns_put(ctx->net, ctx->family);
918916
kfree(priv->timeout);
919917
}

0 commit comments

Comments
 (0)