Skip to content

Commit

Permalink
nfs4: fix discover_server_trunking use after free
Browse files Browse the repository at this point in the history
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.

Cc: stable@vger.kernel.org # 3.7+
Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
  • Loading branch information
westonandrosadamson authored and trondmypd committed Jan 20, 2014
1 parent 64590da commit abad2fa
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions fs/nfs/nfs4client.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,13 +414,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);
Expand Down

0 comments on commit abad2fa

Please sign in to comment.