mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
cfg80211: More error messages for key addition failures
These were helpful while working with extensions to NL80211_CMD_NEW_KEY, so add more explicit error reporting for additional cases that can fail while that command is being processed. Signed-off-by: Jouni Malinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]> Git-repo : git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git Git-commit: f8af764bf1cb86bed615baae84e3bbb6e4d3912d CRs-Fixed: 2671591 Change-Id: Ib3ccbec2914b3f1c8e4ce0039d04b09020f362e4 Signed-off-by: Veerendranath Jakkam <[email protected]>
This commit is contained in:
parent
d5ee68b825
commit
6c3e007eb4
1 changed files with 15 additions and 4 deletions
|
|
@ -3923,8 +3923,10 @@ static int nl80211_new_key(struct sk_buff *skb, struct genl_info *info)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
if (!key.p.key)
|
||||
if (!key.p.key) {
|
||||
GENL_SET_ERR_MSG(info, "no key");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (info->attrs[NL80211_ATTR_MAC])
|
||||
mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
|
||||
|
|
@ -3938,23 +3940,32 @@ static int nl80211_new_key(struct sk_buff *skb, struct genl_info *info)
|
|||
|
||||
/* for now */
|
||||
if (key.type != NL80211_KEYTYPE_PAIRWISE &&
|
||||
key.type != NL80211_KEYTYPE_GROUP)
|
||||
key.type != NL80211_KEYTYPE_GROUP) {
|
||||
GENL_SET_ERR_MSG(info, "key type not pairwise or group");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!rdev->ops->add_key)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (cfg80211_validate_key_settings(rdev, &key.p, key.idx,
|
||||
key.type == NL80211_KEYTYPE_PAIRWISE,
|
||||
mac_addr))
|
||||
mac_addr)) {
|
||||
GENL_SET_ERR_MSG(info, "key setting validation failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
wdev_lock(dev->ieee80211_ptr);
|
||||
err = nl80211_key_allowed(dev->ieee80211_ptr);
|
||||
if (!err)
|
||||
if (err)
|
||||
GENL_SET_ERR_MSG(info, "key not allowed");
|
||||
if (!err) {
|
||||
err = rdev_add_key(rdev, dev, key.idx,
|
||||
key.type == NL80211_KEYTYPE_PAIRWISE,
|
||||
mac_addr, &key.p);
|
||||
if (err)
|
||||
GENL_SET_ERR_MSG(info, "key addition failed");
|
||||
}
|
||||
wdev_unlock(dev->ieee80211_ptr);
|
||||
|
||||
return err;
|
||||
|
|
|
|||
Loading…
Reference in a new issue