Revert "net-sysfs: Fix memory leak in netdev_register_kobject"

This reverts commit 6b70fc94af.

The reverted bugfix will cause another issue.
Reported by syzbot+6024817a931b2830bc93@syzkaller.appspotmail.com.
See https://syzkaller.appspot.com/x/log.txt?x=1737671b200000 for
details.

Signed-off-by: Wang Hai <wanghai26@huawei.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Wang Hai 2019-04-12 16:36:33 -04:00 committed by David S. Miller
parent a44acf9060
commit 8ed633b9ba
1 changed files with 5 additions and 9 deletions

View File

@ -1747,20 +1747,16 @@ int netdev_register_kobject(struct net_device *ndev)
error = device_add(dev);
if (error)
goto error_put_device;
return error;
error = register_queue_kobjects(ndev);
if (error)
goto error_device_del;
if (error) {
device_del(dev);
return error;
}
pm_runtime_set_memalloc_noio(dev, true);
return 0;
error_device_del:
device_del(dev);
error_put_device:
put_device(dev);
return error;
}