linux/net/core
Frank Filz a79af59efd [NET]: Fix module reference counts for loadable protocol modules
I have been experimenting with loadable protocol modules, and ran into
several issues with module reference counting.

The first issue was that __module_get failed at the BUG_ON check at
the top of the routine (checking that my module reference count was
not zero) when I created the first socket. When sk_alloc() is called,
my module reference count was still 0. When I looked at why sctp
didn't have this problem, I discovered that sctp creates a control
socket during module init (when the module ref count is not 0), which
keeps the reference count non-zero. This section has been updated to
address the point Stephen raised about checking the return value of
try_module_get().

The next problem arose when my socket init routine returned an error.
This resulted in my module reference count being decremented below 0.
My socket ops->release routine was also being called. The issue here
is that sock_release() calls the ops->release routine and decrements
the ref count if sock->ops is not NULL. Since the socket probably
didn't get correctly initialized, this should not be done, so we will
set sock->ops to NULL because we will not call try_module_get().

While searching for another bug, I also noticed that sys_accept() has
a possibility of doing a module_put() when it did not do an
__module_get so I re-ordered the call to security_socket_accept().

Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-09-27 15:23:38 -07:00
..
Makefile [NETFILTER]: split net/core/netfilter.c into net/netfilter/*.c 2005-08-29 15:51:11 -07:00
datagram.c [NET]: Use non-recursive algorithm in skb_copy_datagram_iovec() 2005-09-27 15:22:35 -07:00
dev.c [NET]: Prefetch dev->qdisc_lock in dev_queue_xmit() 2005-09-27 15:22:58 -07:00
dev_mcast.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dst.c [PATCH] timer initialization cleanup: DEFINE_TIMER 2005-09-09 14:03:48 -07:00
dv.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ethtool.c [PATCH] (7/7) __user annotations (ethtool) 2005-09-05 17:57:23 -04:00
filter.c [NET]: 2.6.13 breaks libpcap (and tcpdump) 2005-09-05 18:44:37 -07:00
flow.c [NET]: use __read_mostly on kmem_cache_t , DEFINE_SNMP_STAT pointers 2005-08-29 16:11:18 -07:00
gen_estimator.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gen_stats.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
iovec.c [PATCH] misc verify_area cleanups 2005-05-01 08:59:08 -07:00
link_watch.c [NET]: Disable queueing when carrier is lost. 2005-05-03 16:18:52 -07:00
neighbour.c [NEIGH]: Add debugging check when adding timers. 2005-09-27 12:07:44 -07:00
net-sysfs.c [NET]: Allow controlling NAPI device weight with sysfs 2005-06-08 14:55:42 -07:00
netpoll.c [PATCH] more SPIN_LOCK_UNLOCKED -> DEFINE_SPINLOCK conversions 2005-09-09 14:03:48 -07:00
pktgen.c [NET]: fix-up schedule_timeout() usage 2005-09-12 14:15:34 -07:00
request_sock.c [ICSK]: Introduce reqsk_queue_prune from code in tcp_synack_timer 2005-08-29 15:49:29 -07:00
rtnetlink.c [NETLINK]: Add "groups" argument to netlink_kernel_create 2005-08-29 16:01:11 -07:00
scm.c [PATCH] kill gratitious includes of major.h under net/* 2005-04-25 18:32:13 -07:00
skbuff.c [NET]: use __read_mostly on kmem_cache_t , DEFINE_SNMP_STAT pointers 2005-08-29 16:11:18 -07:00
sock.c [NET]: Fix module reference counts for loadable protocol modules 2005-09-27 15:23:38 -07:00
stream.c [PATCH] DocBook: changes and extensions to the kernel documentation 2005-05-01 08:59:25 -07:00
sysctl_net_core.c [NET]: Fix sparse warnings 2005-08-29 16:01:32 -07:00
utils.c [NET]: Fix sparse warnings 2005-08-29 16:01:32 -07:00
wireless.c [PATCH] WE-19 for kernel 2.6.13 2005-09-06 22:40:24 -04:00