From nobody Mon Jan 31 07:31:26 2022 X-Original-To: usb@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 83BF5197DA66 for ; Mon, 31 Jan 2022 07:31:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JnKW21tjjz4nRg for ; Mon, 31 Jan 2022 07:31:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 215D5184D8 for ; Mon, 31 Jan 2022 07:31:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 20V7VQIB013164 for ; Mon, 31 Jan 2022 07:31:26 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 20V7VQuE013163 for usb@FreeBSD.org; Mon, 31 Jan 2022 07:31:26 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f 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 Date: Mon, 31 Jan 2022 07:31:26 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: usb X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: nitin.gupta981@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: usb@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-usb List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-usb@freebsd.org X-BeenThere: freebsd-usb@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643614286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ifVplWBv+fQFCeOCHA57YPQahvn7swfWblKNI3K0uJU=; b=Pkhm23zY8ssRyUEccfBVXI8M2cLXzUO0Fwlodpy/3bX9fuMSOs4W6Baq+jqt8s0iuZPBMM L5ZpbatfF+NZ5lFb42HVevkqDhNhiSq831XJH+PQSJU5xmw+sk/UOx18UidsqUcJ2bmd9U 5JYpkJcP72EkLT+ekWL2g3zG9SBEDSkSblkC9dM3LjZVkj3M6/7mq4H7b80xpmBqpifbfG NROJdQHDp1XgSme9Hvpd9s2unr/MB241uNsakzgyDHx+YQch+r9yhxpPfb4XsU4ZgxUq+0 YP2uo+J+oUfpHwRGVD9ffzx3+CWVkTV2Ek3xthnfhxFVAsYg5U8aUJE9mEjZSg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643614286; a=rsa-sha256; cv=none; b=ZvQesODde7/VKbTWgAKQAgCGOR55i4UtR62Vo4CRvpdRAyL+z2yab+kUjT8PzX2AQQo9zV Kvg5ANz3a3cvMiDbiwqtqDmRKpW7RRYE32VluWMhO6uwmWuFilzOxWB4aeVB1Dh6MgG3Sd ncSvOCYuqK1skTIftLCUfPPjbC2TgV7XUFxVxTi9sy1L5S2octPJLDSxp4Gccc6Mm+PMoh exBqekTGjAAi24/fGkirhGDWzBBX4DBf5W27z/FZY1l4BvaP1BvROcCxYNrMpjfgW3X0kz ZJVRGF62dTVb5VQrCuGJermL+FLh+jrmTljy9exj9PWeLQiRFxjQ1BFSbd+d0A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N 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.=