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: <20200904051830.GA2231475@kroah.com>
Date:   Fri, 4 Sep 2020 07:18:30 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Iouri Tarassov <iourit@...ux.microsoft.com>
Cc:     Pavel Machek <pavel@...x.de>, Sasha Levin <sashal@...nel.org>,
        kys@...rosoft.com, haiyangz@...rosoft.com, sthemmin@...rosoft.com,
        wei.liu@...nel.org, iourit@...rosoft.com,
        linux-kernel@...r.kernel.org, linux-hyperv@...r.kernel.org,
        spronovo@...rosoft.com
Subject: Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

On Thu, Sep 03, 2020 at 02:39:05PM -0700, Iouri Tarassov wrote:
> Hi Greg,
> 
> On 8/27/2020 11:18 PM, Greg KH wrote:
> > On Thu, Aug 27, 2020 at 05:25:23PM -0700, Iouri Tarassov wrote:
> > > > > +bool dxghwqueue_acquire_reference(struct dxghwqueue *hwqueue)
> > > > > +{
> > > > > +	return refcount_inc_not_zero(&hwqueue->refcount);
> > > > > +}
> > > > > > Midlayers are evil.
> > > I strongly agree in general, but think that in our case the layers are very
> > > small. It allows to quickly find all places where a reference/dereference on
> > > an object is done and addition of debug tracing to catch errors.
> > 
> > Again, no, please remove all layers like this.  They just make it
> > impossible for others to review and understand the code over time.
> > 
> > Also, in this specific case, it would have allowed me to easily realize
> > that you are doing this type of call incorrectly and should be using a
> > different data structure :)
> 
> Are you suggesting that the current code is incorrect? Could you comment
> what changes need to be done?

You should be using the built-in reference counting object (a kref) and
not trying to roll your own as you did here.  That way we "know" you got
the logic right and do not have to audit your codebase to prove that
your hand-made one is correct.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ