]> git.baikalelectronics.ru Git - kernel.git/commit
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)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 Mar 2020 08:46:09 +0000 (01:46 -0700)
commit4a1d145827477e596fb9c4892a221f8496fbc482
tree3a2c08f723db982de612dd00162f0a6e3f1b5681
parent7242d73ccb9f4d9f88d88c4954770df0ca9deaf9
hsr: use rcu_read_lock() in hsr_get_node_{list/status}()

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: 8382a55f8658 ("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>
net/hsr/hsr_framereg.c
net/hsr/hsr_netlink.c