Skip to content

Commit e53b145

Browse files
usb: dwc3: gadget: check that event count does not exceed event buffer length
jira VULN-67718 cve CVE-2025-37810 commit-author Frode Isaksen <frode@meta.com> commit 63ccd26 The event count is read from register DWC3_GEVNTCOUNT. There is a check for the count being zero, but not for exceeding the event buffer length. Check that event count does not exceed event buffer length, avoiding an out-of-bounds access when memcpy'ing the event. Crash log: Unable to handle kernel paging request at virtual address ffffffc0129be000 pc : __memcpy+0x114/0x180 lr : dwc3_check_event_buf+0xec/0x348 x3 : 0000000000000030 x2 : 000000000000dfc4 x1 : ffffffc0129be000 x0 : ffffff87aad60080 Call trace: __memcpy+0x114/0x180 dwc3_interrupt+0x24/0x34 Signed-off-by: Frode Isaksen <frode@meta.com> Fixes: 72246da ("usb: Introduce DesignWare USB3 DRD Driver") Cc: stable <stable@kernel.org> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/20250403072907.448524-1-fisaksen@baylibre.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 63ccd26) Signed-off-by: Shreeya Patel <spatel@ciq.com>
1 parent 23253bf commit e53b145

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/usb/dwc3/gadget.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4466,6 +4466,12 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt)
44664466
if (!count)
44674467
return IRQ_NONE;
44684468

4469+
if (count > evt->length) {
4470+
dev_err_ratelimited(dwc->dev, "invalid count(%u) > evt->length(%u)\n",
4471+
count, evt->length);
4472+
return IRQ_NONE;
4473+
}
4474+
44694475
evt->count = count;
44704476
evt->flags |= DWC3_EVENT_PENDING;
44714477

0 commit comments

Comments
 (0)