]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
NFSv4: Fix a problem whereby a buggy server can oops the kernel
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 21 Jul 2009 23:22:38 +0000 (19:22 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 Nov 2009 00:52:39 +0000 (16:52 -0800)
commit23c8301ad483e9453a86dca14a6f729e5bc03885
treeb1761a9539a107a6c4effc442d8e9fdd6b5380c4
parentb8dc9d1b7ffc843ee9dcb697c72b057bee082fc8
NFSv4: Fix a problem whereby a buggy server can oops the kernel

commit d953126a28f97ec965d23c69fd5795854c048f30 upstream.

We just had a case in which a buggy server occasionally returns the wrong
attributes during an OPEN call. While the client does catch this sort of
condition in nfs4_open_done(), and causes the nfs4_atomic_open() to return
-EISDIR, the logic in nfs_atomic_lookup() is broken, since it causes a
fallback to an ordinary lookup instead of just returning the error.

When the buggy server then returns a regular file for the fallback lookup,
the VFS allows the open, and bad things start to happen, since the open
file doesn't have any associated NFSv4 state.

The fix is firstly to return the EISDIR/ENOTDIR errors immediately, and
secondly to ensure that we are always careful when dereferencing the
nfs_open_context state pointer.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/nfs/dir.c
fs/nfs/nfs4proc.c