lkml.org 
[lkml]   [2019]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3] net-sysfs: Fix memory leak in netdev_register_kobject
From
From: Wang Hai <wanghai26@huawei.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@huawei.com>
> Fixes: 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array")
> Signed-off-by: Wang Hai <wanghai26@huawei.com>

Applied and queued up for -stable.

\
 
 \ /
  Last update: 2019-03-21 21:41    [W:0.047 / U:21.880 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site