Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158953
b: refs/heads/master
c: 4d0c8ae
h: refs/heads/master
i:
  158951: 3f16d51
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Jul 10, 2009
1 parent 7d1183d commit 176f692
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 50 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c1e6fb1aad0d4d4f032d46b6bab093a41c6c82bf
refs/heads/master: 4d0c8aead32ecdbe1310ad473b3637991f560865
6 changes: 0 additions & 6 deletions trunk/net/wireless/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,6 @@ cfg80211_get_dev_from_ifindex(int ifindex)
return drv;
}

void cfg80211_put_dev(struct cfg80211_registered_device *drv)
{
BUG_ON(IS_ERR(drv));
mutex_unlock(&drv->mtx);
}

/* requires cfg80211_mutex to be held */
int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
char *newname)
Expand Down
8 changes: 6 additions & 2 deletions trunk/net/wireless/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ __cfg80211_drv_from_info(struct genl_info *info);
* If successful, it returns non-NULL and also locks
* the driver's mutex!
*
* This means that you need to call cfg80211_put_dev()
* This means that you need to call cfg80211_unlock_rdev()
* before being allowed to acquire &cfg80211_mutex!
*
* This is necessary because we need to lock the global
Expand All @@ -170,7 +170,11 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx);
extern struct cfg80211_registered_device *
cfg80211_get_dev_from_ifindex(int ifindex);

extern void cfg80211_put_dev(struct cfg80211_registered_device *drv);
static inline void cfg80211_unlock_rdev(struct cfg80211_registered_device *drv)
{
BUG_ON(IS_ERR(drv) || !drv);
mutex_unlock(&drv->mtx);
}

/* free object */
extern void cfg80211_dev_free(struct cfg80211_registered_device *drv);
Expand Down
74 changes: 37 additions & 37 deletions trunk/net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,14 +411,14 @@ static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info)
if (nl80211_send_wiphy(msg, info->snd_pid, info->snd_seq, 0, dev) < 0)
goto out_free;

cfg80211_put_dev(dev);
cfg80211_unlock_rdev(dev);

return genlmsg_unicast(msg, info->snd_pid);

out_free:
nlmsg_free(msg);
out_err:
cfg80211_put_dev(dev);
cfg80211_unlock_rdev(dev);
return -ENOBUFS;
}

Expand Down Expand Up @@ -737,15 +737,15 @@ static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info)
goto out_free;

dev_put(netdev);
cfg80211_put_dev(dev);
cfg80211_unlock_rdev(dev);

return genlmsg_unicast(msg, info->snd_pid);

out_free:
nlmsg_free(msg);
out_err:
dev_put(netdev);
cfg80211_put_dev(dev);
cfg80211_unlock_rdev(dev);
return -ENOBUFS;
}

Expand Down Expand Up @@ -853,7 +853,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)

unlock:
dev_put(dev);
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
unlock_rtnl:
rtnl_unlock();
return err;
Expand Down Expand Up @@ -906,7 +906,7 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
type, err ? NULL : &flags, &params);

unlock:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
unlock_rtnl:
rtnl_unlock();
return err;
Expand Down Expand Up @@ -934,7 +934,7 @@ static int nl80211_del_interface(struct sk_buff *skb, struct genl_info *info)
err = drv->ops->del_virtual_intf(&drv->wiphy, ifindex);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
unlock_rtnl:
rtnl_unlock();
return err;
Expand Down Expand Up @@ -1037,7 +1037,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
err = -ENOBUFS;
nlmsg_free(msg);
out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
unlock_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -1097,7 +1097,7 @@ static int nl80211_set_key(struct sk_buff *skb, struct genl_info *info)
#endif

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);

unlock_rtnl:
Expand Down Expand Up @@ -1163,7 +1163,7 @@ static int nl80211_new_key(struct sk_buff *skb, struct genl_info *info)
err = drv->ops->add_key(&drv->wiphy, dev, key_idx, mac_addr, &params);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
unlock_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -1211,7 +1211,7 @@ static int nl80211_del_key(struct sk_buff *skb, struct genl_info *info)
#endif

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);

unlock_rtnl:
Expand Down Expand Up @@ -1306,7 +1306,7 @@ static int nl80211_addset_beacon(struct sk_buff *skb, struct genl_info *info)
err = call(&drv->wiphy, dev, &params);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
unlock_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -1338,7 +1338,7 @@ static int nl80211_del_beacon(struct sk_buff *skb, struct genl_info *info)
err = drv->ops->del_beacon(&drv->wiphy, dev);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
unlock_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -1572,7 +1572,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
cb->args[1] = sta_idx;
err = skb->len;
out_err:
cfg80211_put_dev(dev);
cfg80211_unlock_rdev(dev);
out_rtnl:
rtnl_unlock();

Expand Down Expand Up @@ -1624,7 +1624,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
out_free:
nlmsg_free(msg);
out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
out_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -1760,7 +1760,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
out:
if (params.vlan)
dev_put(params.vlan);
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
out_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -1865,7 +1865,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
out:
if (params.vlan)
dev_put(params.vlan);
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
out_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -1904,7 +1904,7 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info)
err = drv->ops->del_station(&drv->wiphy, dev, mac_addr);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
out_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -2035,7 +2035,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
cb->args[1] = path_idx;
err = skb->len;
out_err:
cfg80211_put_dev(dev);
cfg80211_unlock_rdev(dev);
out_rtnl:
rtnl_unlock();

Expand Down Expand Up @@ -2093,7 +2093,7 @@ static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info)
out_free:
nlmsg_free(msg);
out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
out_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -2142,7 +2142,7 @@ static int nl80211_set_mpath(struct sk_buff *skb, struct genl_info *info)
err = drv->ops->change_mpath(&drv->wiphy, dev, dst, next_hop);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
out_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -2190,7 +2190,7 @@ static int nl80211_new_mpath(struct sk_buff *skb, struct genl_info *info)
err = drv->ops->add_mpath(&drv->wiphy, dev, dst, next_hop);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
out_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -2222,7 +2222,7 @@ static int nl80211_del_mpath(struct sk_buff *skb, struct genl_info *info)
err = drv->ops->del_mpath(&drv->wiphy, dev, dst);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
out_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -2278,7 +2278,7 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
err = drv->ops->change_bss(&drv->wiphy, dev, &params);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
out_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -2444,7 +2444,7 @@ static int nl80211_get_mesh_params(struct sk_buff *skb,
err = -EMSGSIZE;
out:
/* Cleanup */
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
out_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -2550,7 +2550,7 @@ static int nl80211_set_mesh_params(struct sk_buff *skb, struct genl_info *info)

out:
/* cleanup */
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
out_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -2890,7 +2890,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
kfree(request);
}
out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
out_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -3007,7 +3007,7 @@ static int nl80211_dump_scan(struct sk_buff *skb,

cb->args[1] = idx;
err = skb->len;
cfg80211_put_dev(dev);
cfg80211_unlock_rdev(dev);
out_put_netdev:
dev_put(netdev);

Expand Down Expand Up @@ -3112,7 +3112,7 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
ssid, ssid_len, ie, ie_len);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
unlock_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -3259,7 +3259,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
&crypto);

out:
cfg80211_put_dev(rdev);
cfg80211_unlock_rdev(rdev);
dev_put(dev);
unlock_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -3321,7 +3321,7 @@ static int nl80211_deauthenticate(struct sk_buff *skb, struct genl_info *info)
err = cfg80211_mlme_deauth(drv, dev, bssid, ie, ie_len, reason_code);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
unlock_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -3383,7 +3383,7 @@ static int nl80211_disassociate(struct sk_buff *skb, struct genl_info *info)
err = cfg80211_mlme_disassoc(drv, dev, bssid, ie, ie_len, reason_code);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
unlock_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -3464,7 +3464,7 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
err = cfg80211_join_ibss(drv, dev, &ibss);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
unlock_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -3501,7 +3501,7 @@ static int nl80211_leave_ibss(struct sk_buff *skb, struct genl_info *info)
err = cfg80211_leave_ibss(drv, dev, false);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
unlock_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -3538,7 +3538,7 @@ static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info)
rdev->testmode_info = NULL;
}

cfg80211_put_dev(rdev);
cfg80211_unlock_rdev(rdev);

unlock_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -3707,7 +3707,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
err = cfg80211_connect(drv, dev, &connect);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
unlock_rtnl:
rtnl_unlock();
Expand Down Expand Up @@ -3748,7 +3748,7 @@ static int nl80211_disconnect(struct sk_buff *skb, struct genl_info *info)
err = cfg80211_disconnect(drv, dev, reason, true);

out:
cfg80211_put_dev(drv);
cfg80211_unlock_rdev(drv);
dev_put(dev);
unlock_rtnl:
rtnl_unlock();
Expand Down
6 changes: 2 additions & 4 deletions trunk/net/wireless/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted)
if (!dev)
goto out;

WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req);

/*
* This must be before sending the other events!
* Otherwise, wpa_supplicant gets completely confused with
Expand Down Expand Up @@ -636,7 +634,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
} else
nl80211_send_scan_start(rdev, dev);
out:
cfg80211_put_dev(rdev);
cfg80211_unlock_rdev(rdev);
return err;
}
EXPORT_SYMBOL_GPL(cfg80211_wext_siwscan);
Expand Down Expand Up @@ -945,7 +943,7 @@ int cfg80211_wext_giwscan(struct net_device *dev,
}

out:
cfg80211_put_dev(rdev);
cfg80211_unlock_rdev(rdev);
return res;
}
EXPORT_SYMBOL_GPL(cfg80211_wext_giwscan);
Expand Down

0 comments on commit 176f692

Please sign in to comment.