mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Yu Hao <yhao016@ucr.edu>,
	kvalo@kernel.org, keescook@chromium.org, gustavoars@kernel.org,
	Jason@zx2c4.com, linux-wireless@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: wireless: cisco: Fix possible uninit bug
Date: Thu, 06 Jul 2023 09:53:53 +0200	[thread overview]
Message-ID: <a8c6e741a9c704dad9b63e1e85136a8e6da09b44.camel@redhat.com> (raw)
In-Reply-To: <CA+UBctBLWF14TsgT4OfanmnxTqbm9mNxyHhjJqpFo7c+kdjDsw@mail.gmail.com>

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


  reply	other threads:[~2023-07-06  7:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-04 23:50 Yu Hao
2023-07-06  7:53 ` Paolo Abeni [this message]
2023-07-10  2:52   ` Yu Hao
2023-07-10 16:19     ` Paolo Abeni
2023-07-11  5:17       ` Yu Hao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a8c6e741a9c704dad9b63e1e85136a8e6da09b44.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=Jason@zx2c4.com \
    --cc=gustavoars@kernel.org \
    --cc=keescook@chromium.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=yhao016@ucr.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®