linux-sg2042/net/hsr
Taehee Yoo 56dc0a0eac hsr: fix refcnt leak of hsr slave interface
In the commit e0a4b99773 ("hsr: use upper/lower device infrastructure"),
dev_get() was removed but dev_put() in the error path wasn't removed.
So, if creating hsr interface command is failed, the reference counter leak
of lower interface would occur.

Test commands:
    ip link add dummy0 type dummy
    ip link add ipvlan0 link dummy0 type ipvlan mode l2
    ip link add ipvlan1 link dummy0 type ipvlan mode l2
    ip link add hsr0 type hsr slave1 ipvlan0 slave2 ipvlan1
    ip link del ipvlan0

Result:
[  633.271992][ T1280] unregister_netdevice: waiting for ipvlan0 to become free. Usage count = -1

Fixes: e0a4b99773 ("hsr: use upper/lower device infrastructure")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-05 11:59:47 -08:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
hsr_debugfs.c hsr: use debugfs_remove_recursive() instead of debugfs_remove() 2020-02-29 21:37:03 -08:00
hsr_device.c hsr: use upper/lower device infrastructure 2020-02-29 21:37:03 -08:00
hsr_device.h hsr: use extack error message instead of netdev_info 2020-02-29 21:37:03 -08:00
hsr_forward.c net: hsr: add tx stats for master interface 2019-04-15 17:22:02 -07:00
hsr_forward.h net: hsr: convert to SPDX identifier 2019-04-06 18:32:21 -07:00
hsr_framereg.c hsr: use netdev_err() instead of WARN_ONCE() 2020-02-29 21:37:03 -08:00
hsr_framereg.h hsr: fix a race condition in node list insertion and deletion 2019-12-25 16:35:35 -08:00
hsr_main.c hsr: use upper/lower device infrastructure 2020-02-29 21:37:03 -08:00
hsr_main.h hsr: use debugfs_remove_recursive() instead of debugfs_remove() 2020-02-29 21:37:03 -08:00
hsr_netlink.c hsr: remove unnecessary rcu_read_lock() in hsr module 2020-02-29 21:37:03 -08:00
hsr_netlink.h net: hsr: convert to SPDX identifier 2019-04-06 18:32:21 -07:00
hsr_slave.c hsr: fix refcnt leak of hsr slave interface 2020-03-05 11:59:47 -08:00
hsr_slave.h hsr: use extack error message instead of netdev_info 2020-02-29 21:37:03 -08:00