linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [lvc-project] [PATCH] staging: rtl8712: fix buffer overflow in r8712_xmitframe_complete()
@ 2023-09-19  9:23 Igor Artemiev
  2023-10-06 13:37 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Igor Artemiev @ 2023-09-19  9:23 UTC (permalink / raw)
  To: Larry Finger
  Cc: Igor Artemiev, Florian Schilhabel, Greg Kroah-Hartman,
	linux-staging, linux-kernel, lvc-project

The value of pxmitframe->attrib.priority in r8712_issue_addbareq_cmd(),
which dump_xframe() calls, is used to calculate the index for accessing 
an array of size 16. The value of pxmitframe->attrib.priority can be 
greater than 15, because the r8712_update_attrib() function can write 
a value up to 31 to attrib.priority, and r8712_xmitframe_complete() 
checks that pxmitframe->attrib.priority is less than 16 before 
calling r8712_xmitframe_coalesce().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Igor Artemiev <Igor.A.Artemiev@mcst.ru>
---
 drivers/staging/rtl8712/rtl8712_xmit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c b/drivers/staging/rtl8712/rtl8712_xmit.c
index 4cb01f590673..8a39a3c8cfcb 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.c
+++ b/drivers/staging/rtl8712/rtl8712_xmit.c
@@ -669,7 +669,7 @@ int r8712_xmitframe_complete(struct _adapter *padapter,
 			 */
 			r8712_xmit_complete(padapter, pxmitframe);
 		}
-		if (res == _SUCCESS)
+		if (res == _SUCCESS && pxmitframe->attrib.priority <= 15)
 			dump_xframe(padapter, pxmitframe);
 		else
 			r8712_free_xmitframe_ex(pxmitpriv, pxmitframe);
-- 
2.30.2


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

* Re: [lvc-project] [PATCH] staging: rtl8712: fix buffer overflow in r8712_xmitframe_complete()
  2023-09-19  9:23 [lvc-project] [PATCH] staging: rtl8712: fix buffer overflow in r8712_xmitframe_complete() Igor Artemiev
@ 2023-10-06 13:37 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2023-10-06 13:37 UTC (permalink / raw)
  To: Igor Artemiev
  Cc: Larry Finger, Florian Schilhabel, linux-staging, linux-kernel,
	lvc-project

On Tue, Sep 19, 2023 at 12:23:18PM +0300, Igor Artemiev wrote:
> The value of pxmitframe->attrib.priority in r8712_issue_addbareq_cmd(),
> which dump_xframe() calls, is used to calculate the index for accessing 
> an array of size 16. The value of pxmitframe->attrib.priority can be 
> greater than 15, because the r8712_update_attrib() function can write 
> a value up to 31 to attrib.priority, and r8712_xmitframe_complete() 
> checks that pxmitframe->attrib.priority is less than 16 before 
> calling r8712_xmitframe_coalesce().

But that number comes from the hardware, so how can it ever be larger
than 15?

> Found by Linux Verification Center (linuxtesting.org) with SVACE.

How was this tested to verify that it can be triggered and that this
change solves anything?

You have read the kernel documentation for what is required when using
"research tools" like this, right?

thanks,

greg k-h

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

end of thread, other threads:[~2023-10-06 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-19  9:23 [lvc-project] [PATCH] staging: rtl8712: fix buffer overflow in r8712_xmitframe_complete() Igor Artemiev
2023-10-06 13:37 ` Greg Kroah-Hartman

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