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]
Message-ID: <20200122150404.GZ2665@lahna.fi.intel.com>
Date:   Wed, 22 Jan 2020 17:04:04 +0200
From:   Mika Westerberg <mika.westerberg@...ux.intel.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Darren Hart <dvhart@...radead.org>,
        Lee Jones <lee.jones@...aro.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H . Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        Zha Qipeng <qipeng.zha@...el.com>,
        "David E . Box" <david.e.box@...ux.intel.com>,
        Guenter Roeck <linux@...ck-us.net>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Wim Van Sebroeck <wim@...ux-watchdog.org>,
        Mark Brown <broonie@...nel.org>,
        platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 14/38] platform/x86: intel_scu_ipc: Introduce new SCU
 IPC API

On Wed, Jan 22, 2020 at 03:49:39PM +0100, Greg Kroah-Hartman wrote:
> On Wed, Jan 22, 2020 at 04:40:48PM +0200, Mika Westerberg wrote:
> > On Wed, Jan 22, 2020 at 02:43:59PM +0100, Greg Kroah-Hartman wrote:
> > > > +	if (!scu->dev)
> > > > +		goto err_unlock;
> > > > +	if (!try_module_get(scu->dev->driver->owner))
> > > > +		goto err_unlock;
> > > > +	mutex_unlock(&ipclock);
> > > > +	return scu;
> > > 
> > > NO REFERENCE COUNT INCREMENT???
> > 
> > You mean increment the scu->dev reference count? I kind of thought that
> > the try_module_get() should make sure the thing stays there as long as
> > the caller has not called _put() but now when I think about it bit more
> > we would need to do device_get() here as well.
> 
> module reference counts handle _code_ while structure reference counts
> handle _data_.
> 
> You should almost never need to worry about module reference counts if
> your code is structured properly, only handle the reference counts on
> the pointers you throw around.
> 
> The fact that you are even calling try_module_get() is a huge flag that
> something is wrong here.

Thanks for the explanation! I'll keep this in mind and make sure the
next version has reference counting done accordingly.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ