alistair23-linux/net
David S. Miller d470e3b483 [NETLINK]: Fix two socket hashing bugs.
1) netlink_release() should only decrement the hash entry
   count if the socket was actually hashed.

   This was causing hash->entries to underflow, which
   resulting in all kinds of troubles.

   On 64-bit systems, this would cause the following
   conditional to erroneously trigger:

	err = -ENOMEM;
	if (BITS_PER_LONG > 32 && unlikely(hash->entries >= UINT_MAX))
		goto err;

2) netlink_autobind() needs to propagate the error return from
   netlink_insert().  Otherwise, callers will not see the error
   as they should and thus try to operate on a socket with a zero pid,
   which is very bad.

   However, it should not propagate -EBUSY.  If two threads race
   to autobind the socket, that is fine.  This is consistent with the
   autobind behavior in other protocols.

   So bug #1 above, combined with this one, resulted in hangs
   on netlink_sendmsg() calls to the rtnetlink socket.  We'd try
   to do the user sendmsg() with the socket's pid set to zero,
   later we do a socket lookup using that pid (via the value we
   stashed away in NETLINK_CB(skb).pid), but that won't give us the
   user socket, it will give us the rtnetlink socket.  So when we
   try to wake up the receive queue, we dive back into rtnetlink_rcv()
   which tries to recursively take the rtnetlink semaphore.

Thanks to Jakub Jelink for providing backtraces.  Also, thanks to
Herbert Xu for supplying debugging patches to help track this down,
and also finding a mistake in an earlier version of this fix.

Signed-off-by: David S. Miller <davem@davemloft.net>
2005-06-26 15:31:51 -07:00
..
802 [TOKENRING]: net/802/tr.c: s/struct rif_cache_s/struct rif_cache/ 2005-05-26 12:59:42 -07:00
8021q [PATCH] misc verify_area cleanups 2005-05-01 08:59:08 -07:00
appletalk [ATALK] aarp: replace schedule_timeout() with msleep() 2005-06-22 22:11:44 -07:00
atm [PATCH] misc verify_area cleanups 2005-05-01 08:59:08 -07:00
ax25 [AX25] Introduce ax25_type_trans 2005-04-24 18:53:06 -07:00
bluetooth [NET]: kill gratitious includes of major.h 2005-04-25 21:40:39 -07:00
bridge [EBTABLES]: vfree() checking cleanups 2005-06-22 22:12:57 -07:00
core [PKTGEN]: Fix random packet sizes causing panic 2005-06-26 15:27:10 -07:00
decnet [DECNET]: Remove unnecessary initilization of unused variable entries 2005-06-18 22:55:02 -07:00
econet
ethernet [PATCH] update Ross Biro bouncing email address 2005-05-05 16:36:49 -07:00
ipv4 [TCP]: Let TCP_CONG_ADVANCED default to n 2005-06-26 15:21:15 -07:00
ipv6 [TCP]: Allow choosing TCP congestion control via sockopt. 2005-06-23 20:37:36 -07:00
ipx
irda [PATCH] ISA DMA Kconfig fixes - part 4 (irda) 2005-05-04 07:33:14 -07:00
key [IPSEC]: Add XFRM_STATE_NOPMTUDISC flag 2005-06-20 13:21:43 -07:00
lapb
llc
netlink [NETLINK]: Fix two socket hashing bugs. 2005-06-26 15:31:51 -07:00
netrom
packet [PATCH] update Ross Biro bouncing email address 2005-05-05 16:36:49 -07:00
rose
rxrpc [PATCH] Cleanup patch for process freezing 2005-06-25 17:10:13 -07:00
sched [PKT_SCHED]: Make TEXTSEARCH* options only selected. 2005-06-24 17:39:03 -07:00
sctp [PATCH] make various thing static 2005-06-24 00:06:43 -07:00
sunrpc Merge Christoph's freeze cleanup patch 2005-06-25 17:16:53 -07:00
unix [AF_UNIX]: Use lookup_create(). 2005-05-19 12:26:43 -07:00
wanrouter [PATCH] misc verify_area cleanups 2005-05-01 08:59:08 -07:00
x25 [X25]: Fast select with no restriction on response 2005-06-22 22:16:17 -07:00
xfrm [IPSEC]: Add xfrm_state_afinfo->init_flags 2005-06-20 13:19:41 -07:00
compat.c
Kconfig
Makefile
nonet.c
socket.c [NET]: dont use strlen() but the result from a prior sprintf() 2005-06-22 14:32:51 -07:00
sysctl_net.c
TUNABLE