linux/net/sunrpc
NeilBrown 1a047060a9 [PATCH] knfsd: fix race that can disable NFS server
This patch is suitable for just about any 2.6 kernel.  It should go in
2.6.19 and 2.6.18.2 and possible even the .17 and .16 stable series.

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: Neil Brown <neilb@suse.de>
Cc: Adrian Bunk <bunk@stusta.de>
Cc: <stable@kernel.org>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-20 10:26:44 -07:00
..
auth_gss [PATCH] net/sunrpc/auth_gss/svcauth_gss.c endianness regression 2006-10-10 15:37:24 -07:00
auth_null.c [SUNRPC]: trivial endianness annotations 2006-09-28 18:01:21 -07:00
auth_unix.c [SUNRPC]: trivial endianness annotations 2006-09-28 18:01:21 -07:00
auth.c [SUNRPC]: trivial endianness annotations 2006-09-28 18:01:21 -07:00
cache.c [PATCH] knfsd: fix race related problem when adding items to and svcrpc auth cache 2006-08-06 08:57:47 -07:00
clnt.c [PATCH] namespaces: utsname: switch to using uts namespaces 2006-10-02 07:57:21 -07:00
Makefile [PATCH] RPC: introduce client-side transport switch 2005-09-23 12:38:12 -04:00
pmap_clnt.c [PATCH] SUNRPC: fix race in in-kernel RPC portmapper client 2006-10-20 10:26:39 -07:00
rpc_pipe.c [PATCH] r/o bind mount prepwork: inc_nlink() helper 2006-10-01 00:39:30 -07:00
sched.c [PATCH] Really ignore kmem_cache_destroy return value 2006-09-27 08:26:10 -07:00
socklib.c [NET]: Replace CHECKSUM_HW by CHECKSUM_PARTIAL/CHECKSUM_COMPLETE 2006-09-22 14:53:53 -07:00
stats.c [NET]: Conversions from kmalloc+memset to k(z|c)alloc. 2006-07-21 14:51:30 -07:00
sunrpc_syms.c [PATCH] knfsd: add svc_set_num_threads 2006-10-02 07:57:19 -07:00
svc.c [PATCH] knfsd: Allow lockd to drop replies as appropriate 2006-10-17 08:18:46 -07:00
svcauth_unix.c [PATCH] knfsd: knfsd: cache ipmap per TCP socket 2006-10-04 07:55:16 -07:00
svcauth.c [SUNRPC]: trivial endianness annotations 2006-09-28 18:01:21 -07:00
svcsock.c [PATCH] knfsd: fix race that can disable NFS server 2006-10-20 10:26:44 -07:00
sysctl.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
timer.c SUNRPC: remove extraneous header inclusions 2006-09-22 23:24:47 -04:00
xdr.c [SUNRPC]: trivial endianness annotations 2006-09-28 18:01:21 -07:00
xprt.c [SUNRPC]: trivial endianness annotations 2006-09-28 18:01:21 -07:00
xprtsock.c [PATCH] SUNRPC: fix a typo 2006-10-20 10:26:39 -07:00