summaryrefslogtreecommitdiffstats
path: root/sys/net/if_epair.c
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2015-09-02 16:30:45 +0000
committerhrs <hrs@FreeBSD.org>2015-09-02 16:30:45 +0000
commit37e142f0ee25d69dbf74d673bcf95844f9fd6fdd (patch)
tree60533421d8cc41c1b867f49bbdf0b8dc39aa289e /sys/net/if_epair.c
parent4eaf6a94f872459e47e9f199f7173c340295f794 (diff)
downloadFreeBSD-src-37e142f0ee25d69dbf74d673bcf95844f9fd6fdd.zip
FreeBSD-src-37e142f0ee25d69dbf74d673bcf95844f9fd6fdd.tar.gz
Fix a panic which was reproducible by an infinite loop of
"ifconfig epair0 create && ifconfig epair0a destroy". This was caused by an uninitialized function pointer in softc->media.
Diffstat (limited to 'sys/net/if_epair.c')
-rw-r--r--sys/net/if_epair.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
index e9a8ed5..fd7a757 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -809,6 +809,14 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
netisr_get_cpuid(sca->ifp->if_index % netisr_get_cpucount());
scb->cpuid =
netisr_get_cpuid(scb->ifp->if_index % netisr_get_cpucount());
+
+ /* Initialise pseudo media types. */
+ ifmedia_init(&sca->media, 0, epair_media_change, epair_media_status);
+ ifmedia_add(&sca->media, IFM_ETHER | IFM_10G_T, 0, NULL);
+ ifmedia_set(&sca->media, IFM_ETHER | IFM_10G_T);
+ ifmedia_init(&scb->media, 0, epair_media_change, epair_media_status);
+ ifmedia_add(&scb->media, IFM_ETHER | IFM_10G_T, 0, NULL);
+ ifmedia_set(&scb->media, IFM_ETHER | IFM_10G_T);
/* Finish initialization of interface <n>a. */
ifp = sca->ifp;
@@ -867,14 +875,6 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
strlcpy(name, sca->ifp->if_xname, len);
DPRINTF("name='%s/%db' created sca=%p scb=%p\n", name, unit, sca, scb);
- /* Initialise pseudo media types. */
- ifmedia_init(&sca->media, 0, epair_media_change, epair_media_status);
- ifmedia_add(&sca->media, IFM_ETHER | IFM_10G_T, 0, NULL);
- ifmedia_set(&sca->media, IFM_ETHER | IFM_10G_T);
- ifmedia_init(&scb->media, 0, epair_media_change, epair_media_status);
- ifmedia_add(&scb->media, IFM_ETHER | IFM_10G_T, 0, NULL);
- ifmedia_set(&scb->media, IFM_ETHER | IFM_10G_T);
-
/* Tell the world, that we are ready to rock. */
sca->ifp->if_drv_flags |= IFF_DRV_RUNNING;
scb->ifp->if_drv_flags |= IFF_DRV_RUNNING;
OpenPOWER on IntegriCloud