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: <20190412125052.GJ2217@ZenIV.linux.org.uk>
Date:   Fri, 12 Apr 2019 13:50:52 +0100
From:   Al Viro <viro@...iv.linux.org.uk>
To:     "wanghai (M)" <wanghai26@...wei.com>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        davem@...emloft.net, idosch@...lanox.com, eric.dumazet@...il.com,
        alexander.h.duyck@...el.com, tyhicks@...onical.com,
        f.fainelli@...il.com, amritha.nambiar@...el.com, joe@...ches.com,
        dmitry.torokhov@...il.com, stephen@...workplumber.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] net-sysfs: Fix memory leak in netdev_register_kobject

On Fri, Apr 12, 2019 at 08:08:32PM +0800, wanghai (M) wrote:
> 
> 在 2019/4/12 16:38, Andy Shevchenko 写道:
> > On Fri, Apr 12, 2019 at 04:36:34PM -0400, Wang Hai wrote:
> > 
> > > +error_register:
> > > +	device_del(dev);
> > > +error_device_add:
> > > +	kfree_const(dev->kobj.name);
> > >   	return error;
> > When put_device() will be called on this it will go to double free (in case of
> > dynamically allocated dev->kobj.name.
> > 
> > Al Viro and me suggested earlier that the correct fix is to call put_device()
> > in a places where it is appropriate.
> Thanks. I'll take a closer look at the code to see when it's time to call
> put_device(). It's really not easy to fix.

Depends upon the driver, obviously...  Note that if it's a built-in
with device never destroyed, that allocation is no leak at all -
reference to the object remains around.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ