Skip to content

Commit 81ed38a

Browse files
Liu Longwenlingz
authored andcommitted
ACRN: xHCI: Check the value of Ring Segment Size
Flow Table 6-95 from xHCI spec, Ring Segment Size defines the number of TRBs supported by the ring segment, valid values for this field are 16 to 4096. Tracked-On: #6981 Signed-off-by: Liu Long <[email protected]>
1 parent 3af09b0 commit 81ed38a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

devicemodel/hw/pci/xhci.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,6 +1836,11 @@ pci_xhci_insert_event(struct pci_xhci_vdev *xdev,
18361836

18371837
erdp = rts->intrreg.erdp & ~0xF;
18381838
erst = &rts->erstba_p[rts->er_enq_seg];
1839+
if (erst->dwRingSegSize < 16 || erst->dwRingSegSize > 4096) {
1840+
UPRINTF(LDBG, "xHCI: ERSTSZ is not valiad: %u\n",
1841+
erst->dwRingSegSize);
1842+
return -EINVAL;
1843+
}
18391844
erdp_idx = (erdp - erst->qwRingSegBase) / sizeof(struct xhci_trb);
18401845

18411846
UPRINTF(LDBG, "insert event 0[%lx] 2[%x] 3[%x]\r\n"

0 commit comments

Comments
 (0)