diff options
author | NeilBrown <neilb@suse.de> | 2012-12-13 08:14:36 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-11 21:06:54 +0400 |
commit | 1627e18aed860a61cc740e9ec9883c63059ae2a3 (patch) | |
tree | 7bb27c280eeb8bed2bfe1c6e5bf98aa7eed6d6de /fs/nfs | |
parent | d1967aac70c3eaf8f93710035b313904deabf6a9 (diff) | |
download | linux-1627e18aed860a61cc740e9ec9883c63059ae2a3.tar.xz |
NFS: avoid NULL dereference in nfs_destroy_server
commit f259613a1e4b44a0cf85a5dafd931be96ee7c9e5 upstream.
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.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/client.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 60f7e4ec842c..37f6de36973c 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -694,8 +694,7 @@ static int nfs_create_rpc_client(struct nfs_client *clp, */ 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); } |