Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134921
b: refs/heads/master
c: 85fd129
h: refs/heads/master
i:
  134919: fef44ce
v: v3
  • Loading branch information
Luis R. Rodriguez authored and John W. Linville committed Feb 27, 2009
1 parent b6bbe7f commit df7f79d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 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: b5850a7a4fd5bcab4f6a2c49e5b4ab9ebb1d5d44
refs/heads/master: 85fd129a721e6e892dbaaf05203baf819730f699
5 changes: 4 additions & 1 deletion trunk/net/wireless/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ cfg80211_drv_by_wiphy_idx(int wiphy_idx)
{
struct cfg80211_registered_device *result = NULL, *drv;

if (!wiphy_idx_valid(wiphy_idx))
return NULL;

list_for_each_entry(drv, &cfg80211_drv_list, list) {
if (drv->wiphy_idx == wiphy_idx) {
result = drv;
Expand Down Expand Up @@ -225,7 +228,7 @@ struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv)

drv->wiphy_idx = wiphy_counter++;

if (unlikely(drv->wiphy_idx < 0)) {
if (unlikely(!wiphy_idx_valid(drv->wiphy_idx))) {
wiphy_counter--;
mutex_unlock(&cfg80211_drv_mutex);
/* ugh, wrapped! */
Expand Down
7 changes: 7 additions & 0 deletions trunk/net/wireless/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ struct cfg80211_registered_device *wiphy_to_dev(struct wiphy *wiphy)
return container_of(wiphy, struct cfg80211_registered_device, wiphy);
}

/* Note 0 is valid, hence phy0 */
static inline
bool wiphy_idx_valid(int wiphy_idx)
{
return (wiphy_idx >= 0);
}

extern struct mutex cfg80211_drv_mutex;
extern struct list_head cfg80211_drv_list;

Expand Down

0 comments on commit df7f79d

Please sign in to comment.