[NETFILTER]: nf_conntrack: Fix module refcount dropping too far

If nf_ct_l3proto_find_get() fails to get the refcount of
nf_ct_l3proto_generic, nf_ct_l3proto_put() will drop the refcount
too far.

This gets rid of '.me = THIS_MODULE' of nf_ct_l3proto_generic so that
nf_ct_l3proto_find_get() doesn't try to get refcount of it.
It's OK because its symbol is usable until nf_conntrack.ko is unloaded.

This also kills unnecessary NULL pointer check as well.
__nf_ct_proto_find() allways returns non-NULL pointer.

Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Yasuyuki Kozakai and committed by David S. Miller e1bbdebd d8fe3f19

+4 -9
+4 -8
net/netfilter/nf_conntrack_core.c
··· 208 208 209 209 preempt_disable(); 210 210 p = __nf_ct_proto_find(l3proto, protocol); 211 - if (p) { 212 - if (!try_module_get(p->me)) 213 - p = &nf_conntrack_generic_protocol; 214 - } 211 + if (!try_module_get(p->me)) 212 + p = &nf_conntrack_generic_protocol; 215 213 preempt_enable(); 216 214 217 215 return p; ··· 227 229 228 230 preempt_disable(); 229 231 p = __nf_ct_l3proto_find(l3proto); 230 - if (p) { 231 - if (!try_module_get(p->me)) 232 - p = &nf_conntrack_generic_l3proto; 233 - } 232 + if (!try_module_get(p->me)) 233 + p = &nf_conntrack_generic_l3proto; 234 234 preempt_enable(); 235 235 236 236 return p;
-1
net/netfilter/nf_conntrack_l3proto_generic.c
··· 94 94 .print_conntrack = generic_print_conntrack, 95 95 .prepare = generic_prepare, 96 96 .get_features = generic_get_features, 97 - .me = THIS_MODULE, 98 97 };