Date: Fri, 8 Mar 2019 19:20:46 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r344933 - in stable: 11/sys/dev/cxgbe 12/sys/dev/cxgbe Message-ID: <201903081920.x28JKkfm068948@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Fri Mar 8 19:20:46 2019 New Revision: 344933 URL: https://svnweb.freebsd.org/changeset/base/344933 Log: MFC 344671: Don't assume all children of a nexus are ports. Specifically, ccr(4) devices are also children of cxgbe nexus devices. Rather than making assumptions about the child device's softc, walk the list of ports from the nexus' softc to determine if a child is a port in t4_child_location_str(). This fixes a panic when detaching a ccr device. Modified: stable/12/sys/dev/cxgbe/t4_main.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/cxgbe/t4_main.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_main.c Fri Mar 8 19:07:41 2019 (r344932) +++ stable/12/sys/dev/cxgbe/t4_main.c Fri Mar 8 19:20:46 2019 (r344933) @@ -1354,10 +1354,19 @@ done: static int t4_child_location_str(device_t bus, device_t dev, char *buf, size_t buflen) { + struct adapter *sc; struct port_info *pi; + int i; - pi = device_get_softc(dev); - snprintf(buf, buflen, "port=%d", pi->port_id); + sc = device_get_softc(bus); + buf[0] = '\0'; + for_each_port(sc, i) { + pi = sc->port[i]; + if (pi != NULL && pi->dev == dev) { + snprintf(buf, buflen, "port=%d", pi->port_id); + break; + } + } return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903081920.x28JKkfm068948>