Repository : ssh://git@diktynna/batman-adv
On branch : master
commit 758b79ab10c342207691dce95553e763fa6733a3 Author: Cong Wang xiyou.wangcong@gmail.com Date: Mon Jun 8 14:53:01 2020 -0700
batman-adv: change addr_list_lock back to static key
The dynamic key update for addr_list_lock still causes troubles, for example the following race condition still exists:
CPU 0: CPU 1: (RCU read lock) (RTNL lock) dev_mc_seq_show() netdev_update_lockdep_key() -> lockdep_unregister_key() -> netif_addr_lock_bh()
because lockdep doesn't provide an API to update it atomically. Therefore, we have to move it back to static keys and use subclass for nest locking like before.
In commit 74efdf49af45 ("batman-adv: partially revert dynamic lockdep key changes"), I already reverted most parts of fced7f6bdf34 ("batman-adv: use generic lockdep keys").
This patch reverts the rest.
Reported-by: syzbot+f3a0e80c34b3fc28ac5e@syzkaller.appspotmail.com Cc: Taehee Yoo ap420073@gmail.com Cc: Dmitry Vyukov dvyukov@google.com Signed-off-by: Cong Wang xiyou.wangcong@gmail.com Signed-off-by: David S. Miller davem@davemloft.net Signed-off-by: Sven Eckelmann sven@narfation.org
758b79ab10c342207691dce95553e763fa6733a3 net/batman-adv/soft-interface.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 0ddd8013..f1f1c86f 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -745,6 +745,7 @@ static int batadv_interface_kill_vid(struct net_device *dev, __be16 proto, * separate class since they always nest. */ static struct lock_class_key batadv_netdev_xmit_lock_key; +static struct lock_class_key batadv_netdev_addr_lock_key;
/** * batadv_set_lockdep_class_one() - Set lockdep class for a single tx queue @@ -765,6 +766,7 @@ static void batadv_set_lockdep_class_one(struct net_device *dev, */ static void batadv_set_lockdep_class(struct net_device *dev) { + lockdep_set_class(&dev->addr_list_lock, &batadv_netdev_addr_lock_key); netdev_for_each_tx_queue(dev, batadv_set_lockdep_class_one, NULL); }