⬢ DragonFlyBSD Kernel Audit
DF-3501 / fix.diff
← back to finding ↓ download raw
--- a/sys/netgraph/fec/ng_fec.c
+++ b/sys/netgraph/fec/ng_fec.c
@@ -351,6 +351,16 @@ ng_fec_addport(struct ng_fec_private *priv, char *iface)
 		return(ENOENT);
 	}
 
+	/* Only ethernet (arpcom) interfaces can join a bundle: the code
+	 * below casts bifp to struct arpcom * and writes ac_enaddr /
+	 * ac_netgraph, which live past the end of a plain struct ifnet
+	 * allocation (e.g. lo0) or on foreign softc fields (e.g. gif). */
+	if (bifp->if_type != IFT_ETHER) {
+		ifnet_unlock();
+		kprintf("fec%d: iface %s is not an ethernet interface\n",
+		    priv->unit, iface);
+		return(EPROTONOSUPPORT);
+	}
+
 	/* See if we have room in the bundle */
 	if (b->fec_ifcnt == FEC_BUNDLESIZ) {
 		ifnet_unlock();