Commit 1778092e authored by Jouni Malinen's avatar Jouni Malinen Committed by John W. Linville

nl80211: Require auth type for NL80211_CMD_AUTHENTICATE

NL80211_ATTR_AUTH_TYPE is a required parameter for
NL80211_CMD_AUTHENTICATE. We are currently (by chance) defaulting to
open system authentication if the attribute is not specified. It is
better to just reject the invalid command.
Signed-off-by: default avatarJouni Malinen <j@w1.fi>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent c0ed4189
...@@ -2752,6 +2752,9 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) ...@@ -2752,6 +2752,9 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
if (!info->attrs[NL80211_ATTR_MAC]) if (!info->attrs[NL80211_ATTR_MAC])
return -EINVAL; return -EINVAL;
if (!info->attrs[NL80211_ATTR_AUTH_TYPE])
return -EINVAL;
rtnl_lock(); rtnl_lock();
err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev); err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
...@@ -2798,13 +2801,10 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) ...@@ -2798,13 +2801,10 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
req.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); req.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]);
} }
if (info->attrs[NL80211_ATTR_AUTH_TYPE]) { req.auth_type = nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]);
req.auth_type = if (!nl80211_valid_auth_type(req.auth_type)) {
nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]); err = -EINVAL;
if (!nl80211_valid_auth_type(req.auth_type)) { goto out;
err = -EINVAL;
goto out;
}
} }
err = drv->ops->auth(&drv->wiphy, dev, &req); err = drv->ops->auth(&drv->wiphy, dev, &req);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment