]> git.baikalelectronics.ru Git - kernel.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)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Jul 2019 21:37:45 +0000 (14:37 -0700)
commite86706fef0cbc64c02e5556b1cd6e27e475ce9ee
tree38c375bc8034c2539c0f2111d2d72df43a3fc83f
parent5f9dea138e65d79722e446a5d139f17c62109df5
hsr: switch ->dellink() to ->ndo_uninit()

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: de4fbf3d2013 ("hsr: implement dellink to clean up resources")
Fixes: ca8842fb5c31 ("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>
net/hsr/hsr_device.c
net/hsr/hsr_device.h
net/hsr/hsr_netlink.c