hsr: use rcu_read_lock() in hsr_get_node_{list/status}()
authorTaehee Yoo <ap420073@gmail.com>
Fri, 13 Mar 2020 06:50:14 +0000 (06:50 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Apr 2020 15:20:31 +0000 (17:20 +0200)
commit9bc97bc67f01b2b729aae0efb070fb0edd38c2dc
treea78ad1dda2185586b54526f0f67eca87d5ca01f5
parentdabbf0e824fac8e98ca942e0962c7764924edeaa
hsr: use rcu_read_lock() in hsr_get_node_{list/status}()

[ Upstream commit 173756b86803655d70af7732079b3aa935e6ab68 ]

hsr_get_node_{list/status}() are not under rtnl_lock() because
they are callback functions of generic netlink.
But they use __dev_get_by_index() without rtnl_lock().
So, it would use unsafe data.
In order to fix it, rcu_read_lock() and dev_get_by_index_rcu()
are used instead of __dev_get_by_index().

Fixes: f421436a591d ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/hsr/hsr_framereg.c
net/hsr/hsr_netlink.c