Skip to content

Commit

Permalink
nl80211: don't assume wdev->netdev exists
Browse files Browse the repository at this point in the history
There are a few places that iterate the wdev
list and assume wdev->netdev exists, check
there. The rfkill one has to be extended for
each non-netdev type later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed Jul 9, 2012
1 parent 72fb2ab commit ba22fb5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/wireless/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
return -EOPNOTSUPP;

list_for_each_entry(wdev, &rdev->wdev_list, list) {
if (!wdev->netdev)
continue;
wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
err = dev_change_net_namespace(wdev->netdev, net, "wlan%d");
if (err)
Expand All @@ -190,6 +192,8 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,

list_for_each_entry_continue_reverse(wdev, &rdev->wdev_list,
list) {
if (!wdev->netdev)
continue;
wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
err = dev_change_net_namespace(wdev->netdev, net,
"wlan%d");
Expand Down Expand Up @@ -227,7 +231,8 @@ static int cfg80211_rfkill_set_block(void *data, bool blocked)
mutex_lock(&rdev->devlist_mtx);

list_for_each_entry(wdev, &rdev->wdev_list, list)
dev_close(wdev->netdev);
if (wdev->netdev)
dev_close(wdev->netdev);

mutex_unlock(&rdev->devlist_mtx);
rtnl_unlock();
Expand Down

0 comments on commit ba22fb5

Please sign in to comment.