diff options
author | Weston Andros Adamson <dros@primarydata.com> | 2014-01-19 22:45:36 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-13 13:55:34 -0800 |
commit | db778db7090bdf908ed268c9cafb698578e875bd (patch) | |
tree | 8e424b433131e8ab09b245961fe683b43e8be2f0 /fs | |
parent | d0d45c8ab8eca458aaffc019dba27fdcd6fe4407 (diff) | |
download | lwn-db778db7090bdf908ed268c9cafb698578e875bd.tar.gz lwn-db778db7090bdf908ed268c9cafb698578e875bd.zip |
nfs4: fix discover_server_trunking use after free
commit abad2fa5ba67725a3f9c376c8cfe76fbe94a3041 upstream.
If clp is new (cl_count = 1) and it matches another client in
nfs4_discover_server_trunking, the nfs_put_client will free clp before
->cl_preserve_clid is set.
Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/nfs4client.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 5049c5a20e62..2b9bfbaab504 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -409,13 +409,11 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp, error = nfs4_discover_server_trunking(clp, &old); if (error < 0) goto error; - nfs_put_client(clp); - if (clp != old) { - clp->cl_preserve_clid = true; - clp = old; - } - return clp; + if (clp != old) + clp->cl_preserve_clid = true; + nfs_put_client(clp); + return old; error: nfs_mark_client_ready(clp, error); |