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] [day] [month] [year] [list]
Message-ID: <Yqni2QQg0uX9Lx13@codewreck.org>
Date:   Wed, 15 Jun 2022 22:47:05 +0900
From:   Dominique Martinet <asmadeus@...ewreck.org>
To:     Christian Schoenebeck <linux_oss@...debyte.com>
Cc:     Eric Van Hensbergen <ericvh@...il.com>,
        Latchesar Ionkov <lucho@...kov.net>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Tyler Hicks <tyhicks@...ux.microsoft.com>,
        v9fs-developer@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
        netdev@...r.kernel.org
Subject: Re: [PATCH v3 04/06] 9p fid refcount: add p9_fid_get/put wrappers

Christian Schoenebeck wrote on Wed, Jun 15, 2022 at 03:00:19PM +0200:
> > -	if (!fid || IS_ERR(fid)) {
> > -		pr_warn("%s (%d): Trying to clunk with invalid fid\n",
> > -			__func__, task_pid_nr(current));
> > -		dump_stack();
> > -		return 0;
> > -	}
> > -	if (!refcount_dec_and_test(&fid->count))
> > -		return 0;
> > -
> 
> I probably would have moved (and that way preserved) that sanity warning to 
> p9_fid_put(), but anyway LGTM.

The existing code was careful not to call clunk on error, but I consider
put() calls to be kind of like free in that it's better to make these
easy to call: this allowed patch 6 reworked most fs/ functions getting a
ref to just initialize fids to NULL and inconditionally call
p9_fid_put() before return.

I guess it's just a matter of preference ultimately, but I think that'll
make it a bit easier to not leak fids. Time will tell if this works :)

> Reviewed-by: Christian Schoenebeck <linux_oss@...debyte.com>

Thanks for this and other reviews!

--
Dominique

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ