mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-19 09:04:57 +00:00
staging: rtl8192u: Fix signedness bug in ieee80211_check_auth_response()
The ieee80211_check_auth_response() function has a signedness bug because it's a declared as a u16 but it return -ENOMEM. When you look at it more closely it returns a mix of error codes including 0xcafe, -ENOMEM, and a->status which is WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG. This is a mess. Clean it up to just return standard kernel error codes. We can print out the a->status before returning a regular error code. The printks in the caller need to be adjusted as well. Signed-off-by: Haowen Bai <baihaowen@meizu.com> Link: https://lore.kernel.org/r/1650593435-9017-1-git-send-email-baihaowen@meizu.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8112446bba
commit
89c734e198
1 changed files with 10 additions and 5 deletions
|
@ -1461,13 +1461,13 @@ void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
|
||||||
spin_unlock_irqrestore(&ieee->lock, flags);
|
spin_unlock_irqrestore(&ieee->lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u16 auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen)
|
static inline int auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen)
|
||||||
{
|
{
|
||||||
struct ieee80211_authentication *a;
|
struct ieee80211_authentication *a;
|
||||||
u8 *t;
|
u8 *t;
|
||||||
if (skb->len < (sizeof(struct ieee80211_authentication) - sizeof(struct ieee80211_info_element))) {
|
if (skb->len < (sizeof(struct ieee80211_authentication) - sizeof(struct ieee80211_info_element))) {
|
||||||
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
|
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
|
||||||
return 0xcafe;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
*challenge = NULL;
|
*challenge = NULL;
|
||||||
a = (struct ieee80211_authentication *)skb->data;
|
a = (struct ieee80211_authentication *)skb->data;
|
||||||
|
@ -1482,7 +1482,12 @@ static inline u16 auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return le16_to_cpu(a->status);
|
if (a->status) {
|
||||||
|
IEEE80211_DEBUG_MGMT("auth_parse() failed\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int auth_rq_parse(struct sk_buff *skb, u8 *dest)
|
static int auth_rq_parse(struct sk_buff *skb, u8 *dest)
|
||||||
|
@ -1829,7 +1834,7 @@ static void ieee80211_check_auth_response(struct ieee80211_device *ieee,
|
||||||
{
|
{
|
||||||
/* default support N mode, disable halfNmode */
|
/* default support N mode, disable halfNmode */
|
||||||
bool bSupportNmode = true, bHalfSupportNmode = false;
|
bool bSupportNmode = true, bHalfSupportNmode = false;
|
||||||
u16 errcode;
|
int errcode;
|
||||||
u8 *challenge;
|
u8 *challenge;
|
||||||
int chlen = 0;
|
int chlen = 0;
|
||||||
u32 iotAction;
|
u32 iotAction;
|
||||||
|
@ -1878,7 +1883,7 @@ static void ieee80211_check_auth_response(struct ieee80211_device *ieee,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ieee->softmac_stats.rx_auth_rs_err++;
|
ieee->softmac_stats.rx_auth_rs_err++;
|
||||||
IEEE80211_DEBUG_MGMT("Auth response status code 0x%x", errcode);
|
IEEE80211_DEBUG_MGMT("Auth response status code %d\n", errcode);
|
||||||
ieee80211_associate_abort(ieee);
|
ieee80211_associate_abort(ieee);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue