linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: functioni: Fix a oob problem in rndis
@ 2025-07-10  8:14 jackysliu
  2025-07-10  8:21 ` Greg KH
  0 siblings, 1 reply; 14+ messages in thread
From: jackysliu @ 2025-07-10  8:14 UTC (permalink / raw)
  To: gregkh; +Cc: 1972843537, viro, linux-usb, linux-kernel

A critical out-of-bounds memory access vulnerability exists in the RNDIS
(Remote Network Driver Interface Specification) implementation.
The vulnerability stems from insufficient boundary validation when
processing SET requests with user-controlled InformationBufferOffset
and InformationBufferLength parameters.

The vulnerability can be fixed by adding addtional boundary checks

Signed-off-by: jackysliu <1972843537@qq.com>
---
 drivers/usb/gadget/function/rndis.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c
index afd75d72412c..cc522fb4c06c 100644
--- a/drivers/usb/gadget/function/rndis.c
+++ b/drivers/usb/gadget/function/rndis.c
@@ -641,7 +641,8 @@ static int rndis_set_response(struct rndis_params *params,
 	BufOffset = le32_to_cpu(buf->InformationBufferOffset);
 	if ((BufLength > RNDIS_MAX_TOTAL_SIZE) ||
 	    (BufOffset > RNDIS_MAX_TOTAL_SIZE) ||
-	    (BufOffset + 8 >= RNDIS_MAX_TOTAL_SIZE))
+	    (BufOffset + 8 >= RNDIS_MAX_TOTAL_SIZE) ||
+		(BufOffset + BufLength+8 > RNDIS_MAX_TOTAL_SIZE))
 		    return -EINVAL;
 
 	r = rndis_add_response(params, sizeof(rndis_set_cmplt_type));
-- 
2.43.5


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

end of thread, other threads:[~2025-07-15  8:48 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10  8:14 [PATCH] usb: gadget: functioni: Fix a oob problem in rndis jackysliu
2025-07-10  8:21 ` Greg KH
2025-07-10  8:49   ` [PATCH v2] " jackysliu
2025-07-10  9:16     ` Greg KH
2025-07-10  9:33       ` jackysliu
2025-07-10  9:34       ` Greg KH
2025-07-10 12:19     ` Greg KH
2025-07-11  3:46       ` jackysliu
2025-07-11  5:54         ` Greg KH
2025-07-11  6:40           ` jackysliu
2025-07-11  6:51             ` Greg KH
2025-07-15  8:20               ` jackysliu
2025-07-15  8:32                 ` Greg KH
2025-07-15  8:47                   ` jackysliu

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