mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
rtnetlink: do not assume RTNL is held in link_master_filtered()
RTNL might be no longer held by the caller in the following patch. Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20260525083542.1565964-5-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
e896e5c073
commit
6768c7c3d7
|
|
@ -2371,22 +2371,24 @@ static struct rtnl_link_ops *linkinfo_to_kind_ops(const struct nlattr *nla,
|
|||
static bool link_master_filtered(struct net_device *dev, int master_idx)
|
||||
{
|
||||
struct net_device *master;
|
||||
bool res = false;
|
||||
|
||||
if (!master_idx)
|
||||
return false;
|
||||
|
||||
master = netdev_master_upper_dev_get(dev);
|
||||
rcu_read_lock();
|
||||
master = netdev_master_upper_dev_get_rcu(dev);
|
||||
|
||||
/* 0 is already used to denote IFLA_MASTER wasn't passed, therefore need
|
||||
* another invalid value for ifindex to denote "no master".
|
||||
*/
|
||||
if (master_idx == -1)
|
||||
return !!master;
|
||||
res = !!master;
|
||||
else if (!master || master->ifindex != master_idx)
|
||||
res = true;
|
||||
rcu_read_unlock();
|
||||
|
||||
if (!master || master->ifindex != master_idx)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return res;
|
||||
}
|
||||
|
||||
static bool link_kind_filtered(const struct net_device *dev,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user