lkml.org 
[lkml]   [2023]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] net: wireless: cisco: Fix possible uninit bug
From
Date
On Tue, 2023-07-04 at 16:50 -0700, Yu Hao wrote:
> The struct cap_rid should be initialized by function readCapabilityRid.
> However, there is not return value check. Iit is possible that
> the function readCapabilityRid returns error code and cap_rid.softCap
> is not initialized. But there is a read later for this field.
>
> Signed-off-by: Yu Hao <yhao016@ucr.edu>
> ---
> drivers/net/wireless/cisco/airo.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/cisco/airo.c
> b/drivers/net/wireless/cisco/airo.c
> index 7c4cc5f5e1eb..b3736d76a5d5 100644
> --- a/drivers/net/wireless/cisco/airo.c
> +++ b/drivers/net/wireless/cisco/airo.c
> @@ -6950,8 +6950,11 @@ static int airo_get_range(struct net_device *dev,
> CapabilityRid cap_rid; /* Card capability info */
> int i;
> int k;
> + int status;
>
> - readCapabilityRid(local, &cap_rid, 1);
> + status = readCapabilityRid(local, &cap_rid, 1);
> + if (status != SUCCESS)
> + return ERROR;

This value is returned directly to the network stack, you must use a
standard error code instead (e.g. -EINVAL).

Also, please add a suitable 'Fixes' tag, thanks!

Paolo

\
 
 \ /
  Last update: 2023-07-06 09:55    [W:0.579 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site