diff options
author | Hante Meuleman <meuleman@broadcom.com> | 2012-11-05 19:22:28 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-11-14 14:56:01 -0500 |
commit | 256c374f7702c8c20413d2d7a14776dfad524a8d (patch) | |
tree | 2173128bad5061e6b2b945e3b8c4291385edebab | |
parent | 3f40b839712fc10b9f981e44a04fd65d3c1d638f (diff) |
brcmfmac: return immediately error for out of range key_idx.
when brcmf_cfg80211_del_key was called with out of range key index
then firmware would return error. Checking was added to
brcmf_cfg80211_del_key to immediately return error.
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 228fcaebefb..4fbf5b32f67 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -1822,6 +1822,12 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, | |||
1822 | if (!check_vif_up(ifp->vif)) | 1822 | if (!check_vif_up(ifp->vif)) |
1823 | return -EIO; | 1823 | return -EIO; |
1824 | 1824 | ||
1825 | if (key_idx >= DOT11_MAX_DEFAULT_KEYS) { | ||
1826 | /* we ignore this key index in this case */ | ||
1827 | WL_ERR("invalid key index (%d)\n", key_idx); | ||
1828 | return -EINVAL; | ||
1829 | } | ||
1830 | |||
1825 | memset(&key, 0, sizeof(key)); | 1831 | memset(&key, 0, sizeof(key)); |
1826 | 1832 | ||
1827 | key.index = (u32) key_idx; | 1833 | key.index = (u32) key_idx; |
@@ -1832,15 +1838,6 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, | |||
1832 | 1838 | ||
1833 | /* Set the new key/index */ | 1839 | /* Set the new key/index */ |
1834 | err = send_key_to_dongle(ndev, &key); | 1840 | err = send_key_to_dongle(ndev, &key); |
1835 | if (err) { | ||
1836 | if (err == -EINVAL) { | ||
1837 | if (key.index >= DOT11_MAX_DEFAULT_KEYS) | ||
1838 | /* we ignore this key index in this case */ | ||
1839 | WL_ERR("invalid key index (%d)\n", key_idx); | ||
1840 | } | ||
1841 | /* Ignore this error, may happen during DISASSOC */ | ||
1842 | err = -EAGAIN; | ||
1843 | } | ||
1844 | 1841 | ||
1845 | WL_TRACE("Exit\n"); | 1842 | WL_TRACE("Exit\n"); |
1846 | return err; | 1843 | return err; |