net: don't decrement kobj reference count on init failure
If kobject_init_and_add failed, then the failure path would
decrement the reference count of the queue kobject whose reference
count was already zero.
Fixes: 114cf58021
("bql: Byte queue limits")
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
01d300c577
commit
d0d6683716
@ -917,20 +917,19 @@ static int rx_queue_add_kobject(struct net_device *dev, int index)
|
|||||||
error = kobject_init_and_add(kobj, &rx_queue_ktype, NULL,
|
error = kobject_init_and_add(kobj, &rx_queue_ktype, NULL,
|
||||||
"rx-%u", index);
|
"rx-%u", index);
|
||||||
if (error)
|
if (error)
|
||||||
goto exit;
|
return error;
|
||||||
|
|
||||||
if (dev->sysfs_rx_queue_group) {
|
if (dev->sysfs_rx_queue_group) {
|
||||||
error = sysfs_create_group(kobj, dev->sysfs_rx_queue_group);
|
error = sysfs_create_group(kobj, dev->sysfs_rx_queue_group);
|
||||||
if (error)
|
if (error) {
|
||||||
goto exit;
|
kobject_put(kobj);
|
||||||
|
return error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kobject_uevent(kobj, KOBJ_ADD);
|
kobject_uevent(kobj, KOBJ_ADD);
|
||||||
dev_hold(queue->dev);
|
dev_hold(queue->dev);
|
||||||
|
|
||||||
return error;
|
|
||||||
exit:
|
|
||||||
kobject_put(kobj);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SYSFS */
|
#endif /* CONFIG_SYSFS */
|
||||||
@ -1339,21 +1338,20 @@ static int netdev_queue_add_kobject(struct net_device *dev, int index)
|
|||||||
error = kobject_init_and_add(kobj, &netdev_queue_ktype, NULL,
|
error = kobject_init_and_add(kobj, &netdev_queue_ktype, NULL,
|
||||||
"tx-%u", index);
|
"tx-%u", index);
|
||||||
if (error)
|
if (error)
|
||||||
goto exit;
|
return error;
|
||||||
|
|
||||||
#ifdef CONFIG_BQL
|
#ifdef CONFIG_BQL
|
||||||
error = sysfs_create_group(kobj, &dql_group);
|
error = sysfs_create_group(kobj, &dql_group);
|
||||||
if (error)
|
if (error) {
|
||||||
goto exit;
|
kobject_put(kobj);
|
||||||
|
return error;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
kobject_uevent(kobj, KOBJ_ADD);
|
kobject_uevent(kobj, KOBJ_ADD);
|
||||||
dev_hold(queue->dev);
|
dev_hold(queue->dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
exit:
|
|
||||||
kobject_put(kobj);
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SYSFS */
|
#endif /* CONFIG_SYSFS */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user