LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ajay Singh <ajay.kathat@microchip.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Ganesh Krishna <ganesh.krishna@microchip.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
<linux-wireless@vger.kernel.org>, <devel@driverdev.osuosl.org>,
<linux-kernel@vger.kernel.org>, <kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] staging: wilc1000: fix infinite loop and out-of-bounds access
Date: Mon, 30 Apr 2018 19:59:16 +0530 [thread overview]
Message-ID: <20180430195916.596a93eb@ajaysk-VirtualBox> (raw)
In-Reply-To: <20180430125040.GA19050@embeddedor.com>
Reviewed-by: Ajay Singh <ajay.kathat@microchip.com>
On Mon, 30 Apr 2018 07:50:40 -0500
"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
> If i < slot_id is initially true then it will remain true. Also,
> as i is being decremented it will end up accessing memory out of
> bounds.
>
> Fix this by incrementing *i* instead of decrementing it.
Nice catch!
Thanks for submitting the changes.
>
> Addresses-Coverity-ID: 1468454 ("Infinite loop")
> Fixes: faa657641081 ("staging: wilc1000: refactor scan() to free
> kmalloc memory on failure cases")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>
> BTW... at first sight it seems to me that variables slot_id
> and i should be of type unsigned instead of signed.
Yes, 'slot_id' & 'i' can be changed to unsigned int.
>
> drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index
> 3ca0c97..67104e8 100644 ---
> a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++
> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -608,7
> +608,7 @@ wilc_wfi_cfg_alloc_fill_ssid(struct cfg80211_scan_request
> *request, out_free:
>
> - for (i = 0; i < slot_id ; i--)
> + for (i = 0; i < slot_id; i++)
> kfree(ntwk->net_info[i].ssid);
>
> kfree(ntwk->net_info);
Regards,
Ajay
next prev parent reply other threads:[~2018-04-30 14:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-30 12:50 Gustavo A. R. Silva
2018-04-30 14:29 ` Ajay Singh [this message]
2018-04-30 15:23 ` Dan Carpenter
2018-05-02 5:47 ` Ajay Singh
2018-05-02 8:39 ` Dan Carpenter
2018-05-02 9:42 ` Ajay Singh
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=20180430195916.596a93eb@ajaysk-VirtualBox \
--to=ajay.kathat@microchip.com \
--cc=devel@driverdev.osuosl.org \
--cc=ganesh.krishna@microchip.com \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo@embeddedor.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--subject='Re: [PATCH] staging: wilc1000: fix infinite loop and out-of-bounds access' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).