Skip to content
Commit a100243d authored by Cong Wang's avatar Cong Wang Committed by David S. Miller
Browse files

rtnetlink: avoid RCU read lock when holding RTNL



When we call af_ops->set_link_af() we hold a RCU read lock
as we retrieve af_ops from the RCU protected list, but this
is unnecessary because we already hold RTNL lock, which is
the writer lock for protecting rtnl_af_ops, so it is safer
than RCU read lock. Similar for af_ops->validate_link_af().

This was not a problem until we begin to take mutex lock
down the path of ->set_link_af() in __ipv6_dev_mc_dec()
recently. We can just drop the RCU read lock there and
assert RTNL lock.

Reported-and-tested-by: default avatar <syzbot+7d941e89dd48bcf42573@syzkaller.appspotmail.com>
Fixes: 63ed8de4 ("mld: add mc_lock for protecting per-interface mld data")
Tested-by: default avatarTaehee Yoo <ap420073@gmail.com>
Signed-off-by: default avatarCong Wang <cong.wang@bytedance.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3f8fca5d
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment