[Bug 261589] review of possible patch in xhci module for panic since td is NULL
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 261589] review of possible patch in xhci module for panic since td is NULL"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 261589] review of possible patch in xhci module for panic since td is NULL"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 31 Jan 2022 07:31:26 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261589 Bug ID: 261589 Summary: review of possible patch in xhci module for panic since td is NULL Product: Base System Version: Unspecified Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: usb Assignee: usb@FreeBSD.org Reporter: nitin.gupta981@gmail.com Created attachment 231457 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=231457&action=edit patch for review in xhci.c Dear Group Member I came across the kernel Panic in xhci module for some of my development activities .Issue is very random and looks like td is NULL .. Please Review the below patch and let me know your thoughts index e88a827..a6ce227 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -886,7 +886,7 @@ xhci_skip_transfer(struct usb_xfer *xfer) static void xhci_check_transfer(struct xhci_softc *sc, struct xhci_trb *trb) { - struct xhci_endpoint_ext *pepext; + struct xhci_endpoint_ext *pepext = NULL; int64_t offset; uint64_t td_event; uint32_t temp; @@ -929,6 +929,10 @@ xhci_check_transfer(struct xhci_softc *sc, struct xhci_trb *trb ) pepext = &sc->sc_hw.devs[index].endp[epno]; + if (pepext == NULL) { + DPRINTF("pepext is Null\n"); + return; + } if (pepext->trb_ep_mode != USB_EP_MODE_STREAMS) { stream_id = 0; @@ -940,8 +944,8 @@ xhci_check_transfer(struct xhci_softc *sc, struct xhci_trb *trb) /* try to find the USB transfer that generated the event */ for (i = 0; i != (XHCI_MAX_TRANSFERS - 1); i++) { - struct usb_xfer *xfer; - struct xhci_td *td; + struct usb_xfer *xfer = NULL; + struct xhci_td *td = NULL; xfer = pepext->xfer[i + (XHCI_MAX_TRANSFERS * stream_id)]; if (xfer == NULL) @@ -949,6 +953,9 @@ xhci_check_transfer(struct xhci_softc *sc, struct xhci_trb *trb) td = xfer->td_transfer_cache; Regards Nitin -- You are receiving this mail because: You are the assignee for the bug.