diff --git a/sys/net/if.c b/sys/net/if.c index df405f088133..98be23e564c6 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1343,8 +1343,8 @@ if_vmove_loan(struct thread *td, struct ifnet *ifp, char *ifname, int jid) /* XXX Lock interfaces to avoid races. */ CURVNET_SET_QUIET(pr->pr_vnet); difp = ifunit(ifname); + CURVNET_RESTORE(); if (difp != NULL) { - CURVNET_RESTORE(); prison_free(pr); return (EEXIST); } @@ -1354,16 +1354,13 @@ if_vmove_loan(struct thread *td, struct ifnet *ifp, char *ifname, int jid) shutdown = VNET_IS_SHUTTING_DOWN(ifp->if_vnet); if (shutdown) { sx_xunlock(&ifnet_detach_sxlock); - CURVNET_RESTORE(); prison_free(pr); return (EBUSY); } - CURVNET_RESTORE(); found = if_unlink_ifnet(ifp, true); if (! found) { sx_xunlock(&ifnet_detach_sxlock); - CURVNET_RESTORE(); prison_free(pr); return (ENODEV); }