lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 22 May 2012 14:45:06 +0000
From:	"Myklebust, Trond" <Trond.Myklebust@...app.com>
To:	Stanislav Kinsbursky <skinsbursky@...allels.com>
CC:	"bfields@...ldses.org" <bfields@...ldses.org>,
	"linux-nfs@...r.kernel.org" <linux-nfs@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"devel@...nvz.org" <devel@...nvz.org>
Subject: Re: [PATCH v3] NFS: put net on idr allocation failure

On Tue, 2012-05-22 at 18:41 +0400, Stanislav Kinsbursky wrote:
> On 22.05.2012 18:37, Myklebust, Trond wrote:
> > On Tue, 2012-05-22 at 12:03 +0400, Stanislav Kinsbursky wrote:
> >> Signed-off-by: Stanislav Kinsbursky<skinsbursky@...allels.com>
> >> ---
> >>   fs/nfs/client.c |    4 +++-
> >>   1 files changed, 3 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/fs/nfs/client.c b/fs/nfs/client.c
> >> index 44cd70f..ae29d4f 100644
> >> --- a/fs/nfs/client.c
> >> +++ b/fs/nfs/client.c
> >> @@ -176,8 +176,10 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_
> >>
> >>   #ifdef CONFIG_NFS_V4
> >>   	err = nfs_get_cb_ident_idr(clp, cl_init->minorversion);
> >> -	if (err)
> >> +	if (err) {
> >> +		put_net(clp->net);
> >>   		goto error_cleanup;
> >> +	}
> >>
> >>   	spin_lock_init(&clp->cl_lock);
> >>   	INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state);
> >>
> >
> > Let's just move the actual get_net() call to the end of the function.
> >
> 
> Ok. But it will look a bit strange, like this:
> 
> clp->net = net;
> ...
> nfs_get_cb_ident_idr
> ...
> get_net(clp->net)
> 
> Or I can pass net to nfs_get_cb_ident_idr() as a parameter.
> Which solution is more preferable&?

Just put the get_net() at the end. It doesn't matter if it looks a bit
odd: the intent is still obvious.

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@...app.com
www.netapp.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ