Date: Mon, 31 Jan 2022 07:31:26 +0000 From: bugzilla-noreply@freebsd.org To: usb@FreeBSD.org Subject: [Bug 261589] review of possible patch in xhci module for panic since td is NULL Message-ID: <bug-261589-19105@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D261589 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=3D231457&action= =3Dedit patch for review in xhci.c Dear Group Member=20 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 =3D 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 =3D &sc->sc_hw.devs[index].endp[epno]; + if (pepext =3D=3D NULL) { + DPRINTF("pepext is Null\n"); + return; + } if (pepext->trb_ep_mode !=3D USB_EP_MODE_STREAMS) { stream_id =3D 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 =3D 0; i !=3D (XHCI_MAX_TRANSFERS - 1); i++) { - struct usb_xfer *xfer; - struct xhci_td *td; + struct usb_xfer *xfer =3D NULL; + struct xhci_td *td =3D NULL; xfer =3D pepext->xfer[i + (XHCI_MAX_TRANSFERS * stream_id)]; if (xfer =3D=3D NULL) @@ -949,6 +953,9 @@ xhci_check_transfer(struct xhci_softc *sc, struct xhci_= trb *trb) td =3D xfer->td_transfer_cache; Regards Nitin --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-261589-19105>