Hi, On Thu, Jan 26, 2017 at 09:13:19PM +0000, Nick Hudson wrote: > @@ -534,14 +527,12 @@ tun_output(struct ifnet *ifp, struct mbu > const struct rtentry *rt) > { > struct tun_softc *tp = ifp->if_softc; > - int s; > int error; > #if defined(INET) || defined(INET6) > int mlen; > uint32_t *af; > #endif > > - s = splnet(); > mutex_enter(&tp->tun_lock); > TUNDEBUG ("%s: tun_output\n", ifp->if_xname); > > @@ -551,6 +542,8 @@ tun_output(struct ifnet *ifp, struct mbu > error = EHOSTDOWN; > goto out; > } > + // XXXrmind > + mutex_exit(&tp->tun_lock); > > /* > * if the queueing discipline needs packet classification, > @@ -576,7 +569,7 @@ tun_output(struct ifnet *ifp, struct mbu > error = ENOBUFS; > goto out; > } > - bcopy(dst, mtod(m0, char *), dst->sa_len); > + memcpy(mtod(m0, char *), dst, dst->sa_len); > } > > if (tp->tun_flags & TUN_IFHEAD) { > @@ -617,9 +610,10 @@ tun_output(struct ifnet *ifp, struct mbu > goto out; > } > > + mutex_enter(&tp->tun_lock);
you call goto out; with &tp->tun-lock not held, it then mutex_exits it.