[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190321.133944.1484834118085536102.davem@davemloft.net>
Date: Thu, 21 Mar 2019 13:39:44 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: wanghai26@...wei.com
Cc: idosch@...lanox.com, alexander.h.duyck@...el.com,
tyhicks@...onical.com, f.fainelli@...il.com,
amritha.nambiar@...el.com, joe@...ches.com,
dmitry.torokhov@...il.com, andriy.shevchenko@...ux.intel.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] net-sysfs: Fix memory leak in
netdev_register_kobject
From: Wang Hai <wanghai26@...wei.com>
Date: Wed, 20 Mar 2019 14:25:05 -0400
> When registering struct net_device, it will call
> register_netdevice ->
> netdev_register_kobject ->
> device_initialize(dev);
> dev_set_name(dev, "%s", ndev->name)
> device_add(dev)
> register_queue_kobjects(ndev)
>
> In netdev_register_kobject(), if device_add(dev) or
> register_queue_kobjects(ndev) failed. Register_netdevice()
> will return error, causing netdev_freemem(ndev) to be
> called to free net_device, however put_device(&dev->dev)->..->
> kobject_cleanup() won't be called, resulting in a memory leak.
>
> syzkaller report this:
...
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Fixes: 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array")
> Signed-off-by: Wang Hai <wanghai26@...wei.com>
Applied and queued up for -stable.
Powered by blists - more mailing lists