Re: [PATCH] NFS: put net in case of idr allocation failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2012-08-20 at 17:43 +0400, Stanislav Kinsbursky wrote:
> Put net reference we got in nfs_alloc_client() on error path.
> 
> Signed-off-by: Stanislav Kinsbursky <skinsbursky@xxxxxxxxxxxxx>
> ---
>  fs/nfs/nfs4client.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
> index cbcdfaf..b895629 100644
> --- a/fs/nfs/nfs4client.c
> +++ b/fs/nfs/nfs4client.c
> @@ -74,6 +74,7 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
>  	return clp;
>  
>  error:
> +	put_net(clp->cl_net);
>  	kfree(clp);
>  	return ERR_PTR(err);
>  }


No, that isn't anywhere near sufficient.

The correct thing to do here is to replace the kfree with a call to
nfs_free_client(), which will also clean up the allocation of
cl_hostname, put the module, etc.

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@xxxxxxxxxx
www.netapp.com

��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux