mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 22:52:19 +02:00
staging: rtl8192e: Fix signedness bug in rtllib_rx_assoc_resp()
The rtllib_rx_assoc_resp() 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. Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Haowen Bai <baihaowen@meizu.com> Link: https://lore.kernel.org/r/1650529277-7893-1-git-send-email-baihaowen@meizu.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
2c61fd036a
commit
97042d0a75
|
|
@ -1764,7 +1764,7 @@ static void rtllib_softmac_check_all_nets(struct rtllib_device *ieee)
|
|||
spin_unlock_irqrestore(&ieee->lock, flags);
|
||||
}
|
||||
|
||||
static inline u16 auth_parse(struct net_device *dev, struct sk_buff *skb,
|
||||
static inline int auth_parse(struct net_device *dev, struct sk_buff *skb,
|
||||
u8 **challenge, int *chlen)
|
||||
{
|
||||
struct rtllib_authentication *a;
|
||||
|
|
@ -1773,7 +1773,7 @@ static inline u16 auth_parse(struct net_device *dev, struct sk_buff *skb,
|
|||
if (skb->len < (sizeof(struct rtllib_authentication) -
|
||||
sizeof(struct rtllib_info_element))) {
|
||||
netdev_dbg(dev, "invalid len in auth resp: %d\n", skb->len);
|
||||
return 0xcafe;
|
||||
return -EINVAL;
|
||||
}
|
||||
*challenge = NULL;
|
||||
a = (struct rtllib_authentication *)skb->data;
|
||||
|
|
@ -1787,7 +1787,13 @@ static inline u16 auth_parse(struct net_device *dev, struct sk_buff *skb,
|
|||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
return le16_to_cpu(a->status);
|
||||
|
||||
if (a->status) {
|
||||
netdev_dbg(dev, "auth_parse() failed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int auth_rq_parse(struct net_device *dev, struct sk_buff *skb, u8 *dest)
|
||||
|
|
@ -2282,7 +2288,7 @@ rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb,
|
|||
|
||||
static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb)
|
||||
{
|
||||
u16 errcode;
|
||||
int errcode;
|
||||
u8 *challenge;
|
||||
int chlen = 0;
|
||||
bool bSupportNmode = true, bHalfSupportNmode = false;
|
||||
|
|
@ -2292,8 +2298,7 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb)
|
|||
if (errcode) {
|
||||
ieee->softmac_stats.rx_auth_rs_err++;
|
||||
netdev_info(ieee->dev,
|
||||
"Authentication response status code 0x%x",
|
||||
errcode);
|
||||
"Authentication response status code %d", errcode);
|
||||
rtllib_associate_abort(ieee);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user