Check that the interface is on the list of cloned interfaces before trying
to remove it to avoid panics in case of two threads trying to remove it in parallel. PR: kern/116837 Submitted by: Takahiro Kurosawa (takahiro.kurosawa gmail.com) (orig version) MFC after: 10 days
This commit is contained in:
parent
43c3bf3cc6
commit
c769e1be01
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=206486
@ -234,6 +234,7 @@ int
|
||||
if_clone_destroyif(struct if_clone *ifc, struct ifnet *ifp)
|
||||
{
|
||||
int err;
|
||||
struct ifnet *ifcifp;
|
||||
|
||||
if (ifc->ifc_destroy == NULL)
|
||||
return(EOPNOTSUPP);
|
||||
@ -246,8 +247,17 @@ if_clone_destroyif(struct if_clone *ifc, struct ifnet *ifp)
|
||||
CURVNET_SET_QUIET(ifp->if_vnet);
|
||||
|
||||
IF_CLONE_LOCK(ifc);
|
||||
IFC_IFLIST_REMOVE(ifc, ifp);
|
||||
LIST_FOREACH(ifcifp, &ifc->ifc_iflist, if_clones) {
|
||||
if (ifcifp == ifp) {
|
||||
IFC_IFLIST_REMOVE(ifc, ifp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
IF_CLONE_UNLOCK(ifc);
|
||||
if (ifcifp == NULL) {
|
||||
CURVNET_RESTORE();
|
||||
return (ENXIO); /* ifp is not on the list. */
|
||||
}
|
||||
|
||||
if_delgroup(ifp, ifc->ifc_name);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user