View | Details | Raw Unified | Return to bug 252608 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/dev/usb/net/if_usie.c (-1 / +1 lines)
Lines 483-489 usie_detach(device_t self) Link Here
483
		usbd_transfer_unsetup(sc->sc_if_xfer, USIE_IF_N_XFER);
483
		usbd_transfer_unsetup(sc->sc_if_xfer, USIE_IF_N_XFER);
484
		bpfdetach(sc->sc_ifp);
484
		bpfdetach(sc->sc_ifp);
485
		if_detach(sc->sc_ifp);
485
		if_detach(sc->sc_ifp);
486
		if_free(sc->sc_ifp);
486
		if_free_sync(sc->sc_ifp);
487
		sc->sc_ifp = NULL;
487
		sc->sc_ifp = NULL;
488
	}
488
	}
489
	/* detach ucom */
489
	/* detach ucom */
(-)b/sys/dev/usb/net/uhso.c (-1 / +1 lines)
Lines 693-700 uhso_detach(device_t self) Link Here
693
		uhso_if_stop(sc);
693
		uhso_if_stop(sc);
694
		bpfdetach(sc->sc_ifp);
694
		bpfdetach(sc->sc_ifp);
695
		if_detach(sc->sc_ifp);
695
		if_detach(sc->sc_ifp);
696
		if_free(sc->sc_ifp);
697
		mtx_unlock(&sc->sc_mtx);
696
		mtx_unlock(&sc->sc_mtx);
697
		if_free_sync(sc->sc_ifp);
698
		usbd_transfer_unsetup(sc->sc_if_xfer, UHSO_IFNET_MAX);
698
		usbd_transfer_unsetup(sc->sc_if_xfer, UHSO_IFNET_MAX);
699
	}
699
	}
700
700
(-)b/sys/dev/usb/net/usb_ethernet.c (-2 / +2 lines)
Lines 292-298 ue_attach_post_task(struct usb_proc_msg *_task) Link Here
292
	/* free unit */
292
	/* free unit */
293
	free_unr(ueunit, ue->ue_unit);
293
	free_unr(ueunit, ue->ue_unit);
294
	if (ue->ue_ifp != NULL) {
294
	if (ue->ue_ifp != NULL) {
295
		if_free(ue->ue_ifp);
295
		if_free_sync(ue->ue_ifp);
296
		ue->ue_ifp = NULL;
296
		ue->ue_ifp = NULL;
297
	}
297
	}
298
	UE_LOCK(ue);
298
	UE_LOCK(ue);
Lines 330-336 uether_ifdetach(struct usb_ether *ue) Link Here
330
		ether_ifdetach(ifp);
330
		ether_ifdetach(ifp);
331
331
332
		/* free interface instance */
332
		/* free interface instance */
333
		if_free(ifp);
333
		if_free_sync(ifp);
334
334
335
		/* free sysctl */
335
		/* free sysctl */
336
		sysctl_ctx_free(&ue->ue_sysctl_ctx);
336
		sysctl_ctx_free(&ue->ue_sysctl_ctx);
(-)b/sys/dev/usb/usb_pf.c (-1 / +1 lines)
Lines 232-238 usbpf_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) Link Here
232
	USB_BUS_UNLOCK(ubus);
232
	USB_BUS_UNLOCK(ubus);
233
	bpfdetach(ifp);
233
	bpfdetach(ifp);
234
	if_detach(ifp);
234
	if_detach(ifp);
235
	if_free(ifp);
235
	if_free_sync(ifp);
236
	ifc_free_unit(ifc, unit);
236
	ifc_free_unit(ifc, unit);
237
237
238
	return (0);
238
	return (0);
(-)b/sys/net/if.c (+18 lines)
Lines 753-758 if_rele(struct ifnet *ifp) Link Here
753
	NET_EPOCH_CALL(if_destroy, &ifp->if_epoch_ctx);
753
	NET_EPOCH_CALL(if_destroy, &ifp->if_epoch_ctx);
754
}
754
}
755
755
756
/* This function blocks until all refcounts are gone on the network interface structure. */
757
void
758
if_free_sync(struct ifnet *ifp)
759
{
760
	/* get our refcount */
761
	if_ref(ifp);
762
763
	/* kick freeing of network interface */
764
	if_free(ifp);
765
766
	/* wait until all refs are gone */
767
	while (refcount_load(&ifp->if_refcount) != 1)
768
		pause("W", hz);
769
770
	/* drop the final reference */
771
	if_rele(ifp);
772
}
773
756
void
774
void
757
ifq_init(struct ifaltq *ifq, struct ifnet *ifp)
775
ifq_init(struct ifaltq *ifq, struct ifnet *ifp)
758
{
776
{
(-)b/sys/net/if_var.h (+1 lines)
Lines 653-658 struct ifmultiaddr * Link Here
653
	if_findmulti(struct ifnet *, const struct sockaddr *);
653
	if_findmulti(struct ifnet *, const struct sockaddr *);
654
void	if_freemulti(struct ifmultiaddr *ifma);
654
void	if_freemulti(struct ifmultiaddr *ifma);
655
void	if_free(struct ifnet *);
655
void	if_free(struct ifnet *);
656
void	if_free_sync(struct ifnet *);
656
void	if_initname(struct ifnet *, const char *, int);
657
void	if_initname(struct ifnet *, const char *, int);
657
void	if_link_state_change(struct ifnet *, int);
658
void	if_link_state_change(struct ifnet *, int);
658
int	if_printf(struct ifnet *, const char *, ...) __printflike(2, 3);
659
int	if_printf(struct ifnet *, const char *, ...) __printflike(2, 3);

Return to bug 252608