Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 136167
b: refs/heads/master
c: 255e737
h: refs/heads/master
i:
  136165: d5210eb
  136163: c2f880f
  136159: c8bb8b6
v: v3
  • Loading branch information
Jouni Malinen authored and John W. Linville committed Mar 28, 2009
1 parent 3eed553 commit 5951857
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 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: 65fc73ac4a310945dfeceac961726c2765ad2ec0
refs/heads/master: 255e737eab645ec6037baeca04a5e0a7c3b1f459
32 changes: 26 additions & 6 deletions trunk/net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -2614,6 +2614,14 @@ static int nl80211_dump_scan(struct sk_buff *skb,
return err;
}

static bool nl80211_valid_auth_type(enum nl80211_auth_type auth_type)
{
return auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM ||
auth_type == NL80211_AUTHTYPE_SHARED_KEY ||
auth_type == NL80211_AUTHTYPE_FT ||
auth_type == NL80211_AUTHTYPE_NETWORK_EAP;
}

static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
{
struct cfg80211_registered_device *drv;
Expand Down Expand Up @@ -2666,6 +2674,10 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
if (info->attrs[NL80211_ATTR_AUTH_TYPE]) {
req.auth_type =
nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]);
if (!nl80211_valid_auth_type(req.auth_type)) {
err = -EINVAL;
goto out;
}
}

err = drv->ops->auth(&drv->wiphy, dev, &req);
Expand Down Expand Up @@ -2718,10 +2730,6 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
}
}

if (nla_len(info->attrs[NL80211_ATTR_SSID]) > IEEE80211_MAX_SSID_LEN) {
err = -EINVAL;
goto out;
}
req.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]);
req.ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]);

Expand Down Expand Up @@ -2769,9 +2777,15 @@ static int nl80211_deauthenticate(struct sk_buff *skb, struct genl_info *info)

req.peer_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);

if (info->attrs[NL80211_ATTR_REASON_CODE])
if (info->attrs[NL80211_ATTR_REASON_CODE]) {
req.reason_code =
nla_get_u16(info->attrs[NL80211_ATTR_REASON_CODE]);
if (req.reason_code == 0) {
/* Reason Code 0 is reserved */
err = -EINVAL;
goto out;
}
}

if (info->attrs[NL80211_ATTR_IE]) {
req.ie = nla_data(info->attrs[NL80211_ATTR_IE]);
Expand Down Expand Up @@ -2817,9 +2831,15 @@ static int nl80211_disassociate(struct sk_buff *skb, struct genl_info *info)

req.peer_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);

if (info->attrs[NL80211_ATTR_REASON_CODE])
if (info->attrs[NL80211_ATTR_REASON_CODE]) {
req.reason_code =
nla_get_u16(info->attrs[NL80211_ATTR_REASON_CODE]);
if (req.reason_code == 0) {
/* Reason Code 0 is reserved */
err = -EINVAL;
goto out;
}
}

if (info->attrs[NL80211_ATTR_IE]) {
req.ie = nla_data(info->attrs[NL80211_ATTR_IE]);
Expand Down

0 comments on commit 5951857

Please sign in to comment.