提交 b6ecfd46 编写于 作者: J Johannes Berg 提交者: Johannes Berg

cfg80211: preserve wdev ID across netns changes

When a wdev changes network namespace, its wdev ID will get
reassigned since NETDEV_REGISTER is called again, in the new
network namespace. Avoid that by checking if it was already
assigned before, and document why we do that.
Reported-and-tested-by: NArend Van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
上级 335d5349
无相关合并请求
......@@ -1159,7 +1159,15 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
INIT_LIST_HEAD(&wdev->mgmt_registrations);
spin_lock_init(&wdev->mgmt_registrations_lock);
wdev->identifier = ++rdev->wdev_id;
/*
* We get here also when the interface changes network namespaces,
* as it's registered into the new one, but we don't want it to
* change ID in that case. Checking if the ID is already assigned
* works, because 0 isn't considered a valid ID and the memory is
* 0-initialized.
*/
if (!wdev->identifier)
wdev->identifier = ++rdev->wdev_id;
list_add_rcu(&wdev->list, &rdev->wiphy.wdev_list);
rdev->devlist_generation++;
/* can only change netns with wiphy */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部