Fix a deadlock with a thread trying to detach the corresponding interface.
ok sashan@, bluhm@
-/* $OpenBSD: if.c,v 1.499 2017/05/28 12:51:33 yasuoka Exp $ */
+/* $OpenBSD: if.c,v 1.500 2017/05/29 06:08:21 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
struct ifnet *ifp;
int s;
- ifp = if_get(ifidx);
- if (ifp == NULL)
- return;
-
NET_LOCK(s);
- if_linkstate(ifp);
- NET_UNLOCK(s);
+ ifp = if_get(ifidx);
+ if (ifp != NULL)
+ if_linkstate(ifp);
if_put(ifp);
+
+ NET_UNLOCK(s);
}
void