[PATCH 4.14 10/46] net-sysfs: fix netdev_queue_add_kobject() breakage
From: Greg Kroah-Hartman
Date: Tue Jan 28 2020 - 08:59:22 EST
From: Eric Dumazet <edumazet@xxxxxxxxxx>
commit 48a322b6f9965b2f1e4ce81af972f0e287b07ed0 upstream.
kobject_put() should only be called in error path.
Fixes: b8eb718348b8 ("net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject")
Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
Cc: Jouni Hogander <jouni.hogander@xxxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
net/core/net-sysfs.c | 1 +
1 file changed, 1 insertion(+)
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1339,6 +1339,7 @@ static int netdev_queue_add_kobject(stru
#endif
kobject_uevent(kobj, KOBJ_ADD);
+ return 0;
err:
kobject_put(kobj);