On Tue, Mar 19, 2019 at 11:19:24AM +0800, wanghai (M) wrote:
在 2019/3/19 0:19, Andy Shevchenko 写道:
quoted
On Mon, Mar 18, 2019 at 08:57:24AM -0700, Stephen Hemminger wrote:
quoted
On Tue, 19 Mar 2019 01:06:57 -0400
Wang Hai [off-list ref] wrote:
quoted
quoted
This looks a bug in device_add() not here.
In general, it is better for an api to clean up after itself.
Since dev->kobj.name is created in device_add and normally freed
in device_del; why is device_add leaving it behind?
It's more likely the bug in syzkaller.
Look at the kobject_cleanup() last lines of code...
If device_add(dev) or register_queue_kobjects(ndev) fails,
In register_netdevice(), dev-> reg_state = NETREG_UNINITIALIZED and returns
an error, causing put_device(&dev-> dev) -> ..-> kobject_cleanup() not to be
called.
OK, that's true, but your patch is wrong.
See error handling in device_create_groups_vargs() for example.
--
With Best Regards,
Andy Shevchenko