knfsd: Fix race that can disable NFS server.
Neil Brown authored
This is a long standing bug that seems to have only recently become
apparent, presumably due to increasing use of NFS over TCP - many
distros seem to be making it the default.

The SK_CONN bit gets set when a listening socket may be ready
for an accept, just as SK_DATA is set when data may be available.

It is entirely possible for svc_tcp_accept to be called with neither
of these set.  It doesn't happen often but there is a small race in
svc_sock_enqueue as SK_CONN and SK_DATA are tested outside the
spin_lock.  They could be cleared immediately after the test and
before the lock is gained.

This normally shouldn't be a problem.  The sockets are non-blocking so
trying to read() or accept() when ther is nothing to do is not a problem.

However: svc_tcp_recvfrom makes the decision "Should I accept() or
should I read()" based on whether SK_CONN is set or not.  This usually
works but is not safe.  The decision should be based on whether it is
a TCP_LISTEN socket or a TCP_CONNECTED socket.
Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
0ac0a208
Name Last commit Last update
..
802 [P8023]: Fix tainting of kernel.
8021q [PATCH] capable/capability.h (net/)
appletalk [PATCH] capable/capability.h (net/)
atm [ATM] CLIP: Do not refer freed skbuff in clip_mkip() (CVE-2006-4997)
ax25 [AX.25]: Fix potencial memory hole.
bluetooth [Bluetooth] Fix NULL pointer dereferences of the HCI socket
bridge ulog: fix panic on SMP kernels
core [PKTGEN]: Make sure skb->{nh,h} are initialized in fill_packet_ipv6() too.
dccp [DCCP] ccid3: Divide by zero fix
decnet [PATCH] capable/capability.h (net/)
econet [ECONET]: Use macro for spinlock_t definition.
ethernet [NET] ethernet: Fix first packet goes out with MAC 00:00:00:00:00:00
ieee80211 ieee80211: TKIP requires CRC32
ipv4 fix RARP ic_servaddr breakage
ipv6 [IPV6]: fix lockup via /proc/net/ip6_flowlabel (CVE-2006-5619)
ipx [PATCH] capable/capability.h (net/)
irda [IRDA]: out of range array access
key [XFRM]: Eliminate refcounting confusion by creating __xfrm_state_put().
lapb [NET]: Kill skb->list
llc [NET]: Add a dev_ioctl() fallback to sock_ioctl()
netfilter ulog: fix panic on SMP kernels
netlink [NETLINK]: Fix use-after-free in netlink_recvmsg
netrom [PATCH] capable/capability.h (net/)
packet [NET]: Fix some whitespace issues in af_packet.c
rose [PATCH] capable/capability.h (net/)
rxrpc [NET]: "signed long" -> "long"
sched PKT_SCHED: cls_basic: Use unsigned int when generating handle
sctp Fix sctp_primitive_ABORT() call in sctp_close()
sunrpc knfsd: Fix race that can disable NFS server.
tipc [TIPC] Avoid polluting the global namespace
unix [PATCH] fix file counting
wanrouter [PATCH] capable/capability.h (net/)
x25 [PATCH] capable/capability.h (net/)
xfrm [IPSEC]: Kill post_input hook and do NAT-T in esp_input directly
Kconfig [NET]: Add CONFIG_NETDEBUG to suppress bad packet messages.
Makefile [TIPC] Initial merge
TUNABLE Linux-2.6.12-rc2
compat.c [PATCH] Fix 32bit sendmsg() flaw
nonet.c [NET]: Fix sock_init() return value.
socket.c [PATCH] percpu data: only iterate over possible CPUs
sysctl_net.c [NET]: Fix "sysctl_net.c:36: error: 'core_table' undeclared here"