lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220414113322.GJ3293@kadam>
Date:   Thu, 14 Apr 2022 14:33:22 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Haowen Bai <baihaowen@...zu.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Staging: rtl8192u: Fix signedness bug in
 ieee80211_check_auth_response()

On Thu, Apr 14, 2022 at 06:32:12PM +0800, Haowen Bai wrote:
> function ieee80211_check_auth_response () unsigned errcode receive auth_parse()'s
> errcode -ENOMEM.
> 
> Signed-off-by: Haowen Bai <baihaowen@...zu.com>
> ---
>  drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> index 1a43979939a8..4d060c3ec077 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> @@ -1461,7 +1461,7 @@ void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
>  	spin_unlock_irqrestore(&ieee->lock, flags);
>  }
>  
> -static inline u16 auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen)
> +static inline s16 auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen)
>  {
>  	struct ieee80211_authentication *a;
>  	u8 *t;


The auth_parse() function returns 0xcafe on error or else it returns
-ENOMEM or it returns WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG (13).  It
returns zero on success.  It's a bit silly to return all these random
things.  It should only return normal kernel error codes.

If we want we could make it print its own error message:

	if (a->status) {
		netdev_info(dev, "Authentication response status code 0x%x",
			    le16_to_cpu(a->status))
		return -EINVAL;
	}

	return 0;

Then delete the printk in the caller or modify it to print an %d instead
of the error code in hex.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ