All of lore.kernel.org
 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; 15+ 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] 15+ messages in thread
* [PATCH v2] scsi: fix out of bounds error in /drivers/scsi
@ 2025-06-19  4:03 jackysliu
  2025-07-15  7:56 ` [PATCH v2] usb: gadget: functioni: Fix a oob problem in rndis jackysliu
  0 siblings, 1 reply; 15+ messages in thread
From: jackysliu @ 2025-06-19  4:03 UTC (permalink / raw)
  To: bvanassche
  Cc: 1972843537, James.Bottomley, linux-kernel, linux-scsi,
	martin.petersen

6.15-stable review patch, vulnerability exists since v6.9

Out-of-bounds vulnerability found in ./drivers/scsi/sd.c
The vulnerability is found by  is found by Wukong-Agent
 (formerly Tencent Woodpecker), a code security AI agent,
 through static code analysis. 

sd_read_block_limits_ext Function Due to Unreasonable boundary checks.
Out-of-bounds read vulnerability exists in the
Linux kernel's SCSI disk driver (./drivers/scsi/sd.c).
The flaw occurs in the sd_read_block_limits_ext function
 when processing Vital Product Data (VPD) page B7 (Block Limits Extension)
 responses from storage devices

A maliciously crafted 4-byte VPD page (0xB7) would cause Out-of-Bounds
Memory Read, leading to potential system Instability 
and Driver State Corruption.


Signed-off-by: jackysliu <1972843537@qq.com>
---
 drivers/scsi/sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3f6e87705b62..eeaa6af294b8 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3384,7 +3384,7 @@ static void sd_read_block_limits_ext(struct scsi_disk *sdkp)
 
 	rcu_read_lock();
 	vpd = rcu_dereference(sdkp->device->vpd_pgb7);
-	if (vpd && vpd->len >= 2)
+	if (vpd && vpd->len >= 6)
 		sdkp->rscs = vpd->data[5] & 1;
 	rcu_read_unlock();
 }
-- 
2.43.5


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

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

Thread overview: 15+ 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
  -- strict thread matches above, loose matches on Subject: below --
2025-06-19  4:03 [PATCH v2] scsi: fix out of bounds error in /drivers/scsi jackysliu
2025-07-15  7:56 ` [PATCH v2] usb: gadget: functioni: Fix a oob problem in rndis jackysliu

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.