From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Ajay Singh <ajay.kathat@microchip.com>,
Ganesh Krishna <ganesh.krishna@microchip.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [PATCH] staging: wilc1000: fix infinite loop and out-of-bounds access
Date: Mon, 30 Apr 2018 12:50:40 +0000 [thread overview]
Message-ID: <20180430125040.GA19050@embeddedor.com> (raw)
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.
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.
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);
--
2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Ajay Singh <ajay.kathat@microchip.com>,
Ganesh Krishna <ganesh.krishna@microchip.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [PATCH] staging: wilc1000: fix infinite loop and out-of-bounds access
Date: Mon, 30 Apr 2018 07:50:40 -0500 [thread overview]
Message-ID: <20180430125040.GA19050@embeddedor.com> (raw)
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.
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.
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);
--
2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Ajay Singh <ajay.kathat@microchip.com>,
Ganesh Krishna <ganesh.krishna@microchip.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [PATCH] staging: wilc1000: fix infinite loop and out-of-bounds access
Date: Mon, 30 Apr 2018 07:50:40 -0500 [thread overview]
Message-ID: <20180430125040.GA19050@embeddedor.com> (raw)
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.
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>
Reviewed-by: Ajay Singh <ajay.kathat@microchip.com>
---
BTW... at first sight it seems to me that variables slot_id
and i should be of type unsigned instead of signed.
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);
--
2.7.4
next reply other threads:[~2018-04-30 12:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-30 12:50 Gustavo A. R. Silva [this message]
2018-04-30 12:50 ` [PATCH] staging: wilc1000: fix infinite loop and out-of-bounds access Gustavo A. R. Silva
2018-04-30 12:50 ` Gustavo A. R. Silva
2018-04-30 14:29 ` Ajay Singh
2018-04-30 14:41 ` Ajay Singh
2018-04-30 15:23 ` Dan Carpenter
2018-04-30 15:23 ` Dan Carpenter
2018-04-30 15:23 ` Dan Carpenter
2018-05-02 5:47 ` Ajay Singh
2018-05-02 5:59 ` Ajay Singh
2018-05-02 5:47 ` Ajay Singh
2018-05-02 8:39 ` Dan Carpenter
2018-05-02 8:39 ` Dan Carpenter
2018-05-02 8:39 ` Dan Carpenter
2018-05-02 9:42 ` Ajay Singh
2018-05-02 9:54 ` Ajay Singh
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=20180430125040.GA19050@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=ajay.kathat@microchip.com \
--cc=devel@driverdev.osuosl.org \
--cc=ganesh.krishna@microchip.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.