kernel-hacking-2024-linux-s.../net
Arjan van de Ven 4c8411f8c1 bluetooth: fix locking bug in the rfcomm socket cleanup handling
in net/bluetooth/rfcomm/sock.c, rfcomm_sk_state_change() does the
following operation:

        if (parent && sock_flag(sk, SOCK_ZAPPED)) {
                /* We have to drop DLC lock here, otherwise
                 * rfcomm_sock_destruct() will dead lock. */
                rfcomm_dlc_unlock(d);
                rfcomm_sock_kill(sk);
                rfcomm_dlc_lock(d);
        }
}

which is fine, since rfcomm_sock_kill() will call sk_free() which will call
rfcomm_sock_destruct() which takes the rfcomm_dlc_lock()... so far so good.

HOWEVER, this assumes that the rfcomm_sk_state_change() function always gets
called with the rfcomm_dlc_lock() taken. This is the case for all but one
case, and in that case where we don't have the lock, we do a double unlock
followed by an attempt to take the lock, which due to underflow isn't
going anywhere fast.

This patch fixes this by moving the stragling case inside the lock, like
the other usages of the same call are doing in this code.

This was found with the help of the www.kerneloops.org project, where this
deadlock was observed 51 times at this point in time:
http://www.kerneloops.org/search.php?search=rfcomm_sock_destruct

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-29 01:32:47 -07:00
..
9p 9p: fix error path during early mount 2008-05-14 19:23:27 -05:00
802
8021q vlan: Use bitmask of feature flags instead of seperate feature bits 2008-05-23 00:27:50 -07:00
appletalk
atm Revert "atm: Do not free already unregistered net device." 2008-05-06 00:00:16 -07:00
ax25
bluetooth bluetooth: fix locking bug in the rfcomm socket cleanup handling 2008-05-29 01:32:47 -07:00
bridge bridge: Consolidate error paths in br_add_bridge(). 2008-05-04 17:58:07 -07:00
can Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-05-08 19:03:26 -07:00
core pktgen: make sure that pktgen_thread_worker has been executed 2008-05-20 15:12:44 -07:00
dccp dccp ccid-3: Fix "t_ipi explosion" bug 2008-05-27 06:33:54 -07:00
decnet ip: Use inline function dst_metric() instead of direct access to dst->metric[] 2008-05-04 22:14:42 -07:00
econet net: Allow netdevices to specify needed head/tailroom 2008-05-12 20:48:31 -07:00
ethernet
ieee80211
ipv4 net: The world is not perfect patch. 2008-05-21 17:47:54 -07:00
ipv6 net: The world is not perfect patch. 2008-05-21 17:47:54 -07:00
ipx
irda net/irda/irnet/irnet_irda.c needs unaligned.h 2008-05-14 19:11:15 -07:00
iucv
key af_key: Fix selector family initialization. 2008-05-21 13:26:11 -07:00
lapb
llc
mac80211 mac80211: fix NULL pointer dereference in ieee80211_compatible_rates 2008-05-20 22:40:30 -04:00
netfilter Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-05-14 10:08:24 -07:00
netlabel Audit: collect sessionid in netlink messages 2008-04-28 06:18:03 -04:00
netlink Audit: collect sessionid in netlink messages 2008-04-28 06:18:03 -04:00
netrom
packet net: Allow netdevices to specify needed head/tailroom 2008-05-12 20:48:31 -07:00
rfkill
rose rose: Wrong list_lock argument in rose_node seqops 2008-05-02 17:03:22 -07:00
rxrpc net: Add missing braces to multi-statement if()s 2008-05-02 16:20:10 -07:00
sched net_sched: cls_api: fix return value for non-existant classifiers 2008-05-20 14:34:46 -07:00
sctp sctp: Fix use of uninitialized pointer 2008-05-13 23:25:00 -07:00
sunrpc Remove duplicated include in net/sunrpc/svc.c 2008-05-08 10:58:25 -07:00
tipc tipc: Increase buffer header to support worst-case device 2008-05-08 21:38:24 -07:00
unix Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-04-24 08:40:34 -07:00
wanrouter
wireless
x25
xfrm xfrm_user: Remove zero length key checks. 2008-05-21 17:36:21 -07:00
compat.c net: Add compat support for getsockopt (MCAST_MSFILTER) 2008-04-29 03:23:22 -07:00
Kconfig
Makefile
nonet.c
socket.c
sysctl_net.c net: fix returning void-valued expression warnings 2008-05-01 02:47:38 -07:00
TUNABLE