aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/client.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-12-13 15:14:36 +1100
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-12-12 23:55:56 -0500
commitf259613a1e4b44a0cf85a5dafd931be96ee7c9e5 (patch)
tree032efdf98b5335c172b72a7659e25cde901530be /fs/nfs/client.c
parenteb96d5c97b0825d542e9c4ba5e0a22b519355166 (diff)
downloadkernel_goldelico_gta04-f259613a1e4b44a0cf85a5dafd931be96ee7c9e5.zip
kernel_goldelico_gta04-f259613a1e4b44a0cf85a5dafd931be96ee7c9e5.tar.gz
kernel_goldelico_gta04-f259613a1e4b44a0cf85a5dafd931be96ee7c9e5.tar.bz2
NFS: avoid NULL dereference in nfs_destroy_server
In rare circumstances, nfs_clone_server() of a v2 or v3 server can get an error between setting server->destory (to nfs_destroy_server), and calling nfs_start_lockd (which will set server->nlm_host). If this happens, nfs_clone_server will call nfs_free_server which will call nfs_destroy_server and thence nlmclnt_done(NULL). This causes the NULL to be dereferenced. So add a guard to only call nlmclnt_done() if ->nlm_host is not NULL. The other guards there are irrelevant as nlm_host can only be non-NULL if one of these flags are set - so remove those tests. (Thanks to Trond for this suggestion). This is suitable for any stable kernel since 2.6.25. Cc: stable@vger.kernel.org Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r--fs/nfs/client.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index c285e0a..9f3c664 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -615,8 +615,7 @@ EXPORT_SYMBOL_GPL(nfs_create_rpc_client);
*/
static void nfs_destroy_server(struct nfs_server *server)
{
- if (!(server->flags & NFS_MOUNT_LOCAL_FLOCK) ||
- !(server->flags & NFS_MOUNT_LOCAL_FCNTL))
+ if (server->nlm_host)
nlmclnt_done(server->nlm_host);
}