]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
hsr: switch ->dellink() to ->ndo_uninit()
authorCong Wang <xiyou.wangcong@gmail.com>
Wed, 10 Jul 2019 06:24:54 +0000 (23:24 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Sep 2019 08:23:51 +0000 (10:23 +0200)
commit4d8966020827bb83197f995af58ec7e976113d62
tree84eef33dd175ddfc929cef6009ea60f5543d8098
parent072c9337f3a0685f6319fe42fa075c2e3957cf83
hsr: switch ->dellink() to ->ndo_uninit()

[ Upstream commit 311633b604063a8a5d3fbc74d0565b42df721f68 ]

Switching from ->priv_destructor to dellink() has an unexpected
consequence: existing RCU readers, that is, hsr_port_get_hsr()
callers, may still be able to read the port list.

Instead of checking the return value of each hsr_port_get_hsr(),
we can just move it to ->ndo_uninit() which is called after
device unregister and synchronize_net(), and we still have RTNL
lock there.

Fixes: b9a1e627405d ("hsr: implement dellink to clean up resources")
Fixes: edf070a0fb45 ("hsr: fix a NULL pointer deref in hsr_dev_xmit()")
Reported-by: syzbot+097ef84cdc95843fbaa8@syzkaller.appspotmail.com
Cc: Arvid Brodin <arvid.brodin@alten.se>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/hsr/hsr_device.c
net/hsr/hsr_device.h
net/hsr/hsr_netlink.c