Skip to content

Commit

Permalink
NFS: Ensure struct nfs_client holds a reference to the net namespace
Browse files Browse the repository at this point in the history
Otherwise we have no guarantee that the net namespace won't just
disappear from underneath us once the task that created it
is destroyed.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Feb 19, 2012
1 parent 9937347 commit abd9669
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/nfs/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_
clp->cl_rpcclient = ERR_PTR(-EINVAL);

clp->cl_proto = cl_init->proto;
clp->net = cl_init->net;
clp->net = get_net(cl_init->net);

#ifdef CONFIG_NFS_V4
err = nfs_get_cb_ident_idr(clp, cl_init->minorversion);
Expand Down Expand Up @@ -300,6 +300,7 @@ static void nfs_free_client(struct nfs_client *clp)

nfs4_deviceid_purge_client(clp);

put_net(clp->net);
kfree(clp->cl_hostname);
kfree(clp->server_scope);
kfree(clp);
Expand Down

0 comments on commit abd9669

Please sign in to comment.