kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH v2] staging/wlan-ng: Fix potential buffer overflow in firmware handling
@ 2015-10-10 19:56 Tillmann Heidsieck
  2015-10-12 11:14 ` Sudip Mukherjee
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tillmann Heidsieck @ 2015-10-10 19:56 UTC (permalink / raw)
  To: kernel-janitors

This patch fixes a potential buffer overflow detected by smatch.

pda16 has length 512, while processing an element with index < 512 we
are checking for an end marker in the next element. This poses a
potential buffer overflow if no end marker is present.

Signed-off-by: Tillmann Heidsieck <theidsieck@leenox.de>
---
v2: add missing Signed-off-by line


 drivers/staging/wlan-ng/prism2fw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c
index fe36613..d357b7e 100644
--- a/drivers/staging/wlan-ng/prism2fw.c
+++ b/drivers/staging/wlan-ng/prism2fw.c
@@ -590,7 +590,7 @@ static int mkpdrlist(struct pda *pda)
 
 	pda->nrec = 0;
 	curroff = 0;
-	while (curroff < (HFA384x_PDA_LEN_MAX / 2) &&
+	while (curroff < (HFA384x_PDA_LEN_MAX / 2 - 1) &&
 	       le16_to_cpu(pda16[curroff + 1]) != HFA384x_PDR_END_OF_PDA) {
 		pda->rec[pda->nrec] = (hfa384x_pdrec_t *) &(pda16[curroff]);
 
@@ -626,7 +626,7 @@ static int mkpdrlist(struct pda *pda)
 		curroff += le16_to_cpu(pda16[curroff]) + 1;
 
 	}
-	if (curroff >= (HFA384x_PDA_LEN_MAX / 2)) {
+	if (curroff >= (HFA384x_PDA_LEN_MAX / 2 - 1)) {
 		pr_err("no end record found or invalid lengths in PDR data, exiting. %x %d\n",
 		       curroff, pda->nrec);
 		return 1;
-- 
2.6.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH v2] staging/wlan-ng: Fix potential buffer overflow in firmware handling
  2015-10-10 19:56 [RESEND PATCH v2] staging/wlan-ng: Fix potential buffer overflow in firmware handling Tillmann Heidsieck
@ 2015-10-12 11:14 ` Sudip Mukherjee
  2015-10-12 11:35 ` Tillmann Heidsieck
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Sudip Mukherjee @ 2015-10-12 11:14 UTC (permalink / raw)
  To: kernel-janitors

On Sat, Oct 10, 2015 at 09:56:16PM +0200, Tillmann Heidsieck wrote:
> This patch fixes a potential buffer overflow detected by smatch.
> 
> pda16 has length 512, while processing an element with index < 512 we
> are checking for an end marker in the next element. This poses a
> potential buffer overflow if no end marker is present.
> 
> Signed-off-by: Tillmann Heidsieck <theidsieck@leenox.de>
> ---

Confused.
This you have already sent previously and has already been merged by
Greg.
4ccb726c728c ("staging: wlan-ng fix buffer overflow in firmware handling")

Signed-off-by: Tillmann Heidsieck <theidsieck@leenox.de>
Dated: Wed Sep 23

regards
sudip

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH v2] staging/wlan-ng: Fix potential buffer overflow in firmware handling
  2015-10-10 19:56 [RESEND PATCH v2] staging/wlan-ng: Fix potential buffer overflow in firmware handling Tillmann Heidsieck
  2015-10-12 11:14 ` Sudip Mukherjee
@ 2015-10-12 11:35 ` Tillmann Heidsieck
  2015-10-12 11:53 ` Sudip Mukherjee
  2015-10-13 12:58 ` Tillmann Heidsieck
  3 siblings, 0 replies; 5+ messages in thread
From: Tillmann Heidsieck @ 2015-10-12 11:35 UTC (permalink / raw)
  To: kernel-janitors

Oh sorry for the noise ... I officially suck and will try to better
myself. 

I must have rediscovered a problem I already fixed :-(

Again sorry for the noise
Tillmann

On Mon, Oct 12, 2015 at 04:32:17PM +0530, Sudip Mukherjee wrote:
> On Sat, Oct 10, 2015 at 09:56:16PM +0200, Tillmann Heidsieck wrote:
> > This patch fixes a potential buffer overflow detected by smatch.
> > 
> > pda16 has length 512, while processing an element with index < 512 we
> > are checking for an end marker in the next element. This poses a
> > potential buffer overflow if no end marker is present.
> > 
> > Signed-off-by: Tillmann Heidsieck <theidsieck@leenox.de>
> > ---
> 
> Confused.
> This you have already sent previously and has already been merged by
> Greg.
> 4ccb726c728c ("staging: wlan-ng fix buffer overflow in firmware handling")
> 
> Signed-off-by: Tillmann Heidsieck <theidsieck@leenox.de>
> Dated: Wed Sep 23
> 
> regards
> sudip

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH v2] staging/wlan-ng: Fix potential buffer overflow in firmware handling
  2015-10-10 19:56 [RESEND PATCH v2] staging/wlan-ng: Fix potential buffer overflow in firmware handling Tillmann Heidsieck
  2015-10-12 11:14 ` Sudip Mukherjee
  2015-10-12 11:35 ` Tillmann Heidsieck
@ 2015-10-12 11:53 ` Sudip Mukherjee
  2015-10-13 12:58 ` Tillmann Heidsieck
  3 siblings, 0 replies; 5+ messages in thread
From: Sudip Mukherjee @ 2015-10-12 11:53 UTC (permalink / raw)
  To: kernel-janitors

On Mon, Oct 12, 2015 at 01:35:54PM +0200, Tillmann Heidsieck wrote:
> 
> I must have rediscovered a problem I already fixed :-(

Which tree are you using? You should be using staging-testing branch of
the staging tree.

regards
sudip

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH v2] staging/wlan-ng: Fix potential buffer overflow in firmware handling
  2015-10-10 19:56 [RESEND PATCH v2] staging/wlan-ng: Fix potential buffer overflow in firmware handling Tillmann Heidsieck
                   ` (2 preceding siblings ...)
  2015-10-12 11:53 ` Sudip Mukherjee
@ 2015-10-13 12:58 ` Tillmann Heidsieck
  3 siblings, 0 replies; 5+ messages in thread
From: Tillmann Heidsieck @ 2015-10-13 12:58 UTC (permalink / raw)
  To: kernel-janitors

On Mon, Oct 12, 2015 at 05:11:08PM +0530, Sudip Mukherjee wrote:
> On Mon, Oct 12, 2015 at 01:35:54PM +0200, Tillmann Heidsieck wrote:
> > 
> > I must have rediscovered a problem I already fixed :-(
> 
> Which tree are you using? You should be using staging-testing branch of
> the staging tree.

Thanks for pointing this out. I was in fact using the wrong branch as a
base. Can you point me in the direction of some sort of best-practice or
example work-flow on how to work with all the different trees and
branches? I always like to see how different people do things in order
to combine them and find what suits me best. 

> 
> regards
> sudip

regards
Tillmann

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-13 12:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-10 19:56 [RESEND PATCH v2] staging/wlan-ng: Fix potential buffer overflow in firmware handling Tillmann Heidsieck
2015-10-12 11:14 ` Sudip Mukherjee
2015-10-12 11:35 ` Tillmann Heidsieck
2015-10-12 11:53 ` Sudip Mukherjee
2015-10-13 12:58 ` Tillmann Heidsieck

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).