summaryrefslogtreecommitdiffstats
path: root/net/hsr/hsr_netlink.c
diff options
context:
space:
mode:
authorCong Wang <xiyou.wangcong@gmail.com>2019-07-09 23:24:54 -0700
committerDavid S. Miller <davem@davemloft.net>2019-07-11 14:37:45 -0700
commit311633b604063a8a5d3fbc74d0565b42df721f68 (patch)
tree38c375bc8034c2539c0f2111d2d72df43a3fc83f /net/hsr/hsr_netlink.c
parentaa4c0c9091b0bb4cb261bbe0718d17c2834c4690 (diff)
downloadlinux-311633b604063a8a5d3fbc74d0565b42df721f68.tar.gz
linux-311633b604063a8a5d3fbc74d0565b42df721f68.tar.bz2
linux-311633b604063a8a5d3fbc74d0565b42df721f68.zip
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: 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>
Diffstat (limited to 'net/hsr/hsr_netlink.c')
-rw-r--r--net/hsr/hsr_netlink.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c
index 160edd24de4e..8f8337f893ba 100644
--- a/net/hsr/hsr_netlink.c
+++ b/net/hsr/hsr_netlink.c
@@ -69,12 +69,6 @@ static int hsr_newlink(struct net *src_net, struct net_device *dev,
return hsr_dev_finalize(dev, link, multicast_spec, hsr_version);
}
-static void hsr_dellink(struct net_device *hsr_dev, struct list_head *head)
-{
- hsr_dev_destroy(hsr_dev);
- unregister_netdevice_queue(hsr_dev, head);
-}
-
static int hsr_fill_info(struct sk_buff *skb, const struct net_device *dev)
{
struct hsr_priv *hsr;
@@ -119,7 +113,6 @@ static struct rtnl_link_ops hsr_link_ops __read_mostly = {
.priv_size = sizeof(struct hsr_priv),
.setup = hsr_dev_setup,
.newlink = hsr_newlink,
- .dellink = hsr_dellink,
.fill_info = hsr_fill_info,
};