mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-07 00:50:50 +00:00
iflib: Fix detach of pseudo interfaces
In commit38bfc6dee3
we added an IFDI_DETACH() call to iflib_pseudo_deregister() since it looked like it was missing. One is present in the error-handling path of iflib_pseudo_register(). However, the detach actually comes from the DEVICE_DETACH() method for the above-mentioned device_t, so now we're calling IFDI_DETACH() twice when destroying a pseudo interface. Fix the problem by not calling IFDI_DETACH() from the device detach routine. This way we can ensure that iflib de-initialization always happens in a consistent order. It also ensures that you can't do silly things like "devctl detach <pseudo ifnet>", which would previously detach the driver without tearing down the corresponding ifnet. PR: 253541 Reviewed by: erj MFC after: 1 week Fixes:38bfc6dee3
Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28774
This commit is contained in:
parent
d2b3fadf2d
commit
0f9544d03e
|
@ -81,13 +81,11 @@ int
|
|||
iflib_pseudo_detach(device_t dev)
|
||||
{
|
||||
if_ctx_t ctx;
|
||||
uint32_t ifc_flags;
|
||||
|
||||
ctx = device_get_softc(dev);
|
||||
ifc_flags = iflib_get_flags(ctx);
|
||||
if ((ifc_flags & IFC_INIT_DONE) == 0)
|
||||
return (0);
|
||||
return (IFDI_DETACH(ctx));
|
||||
if ((iflib_get_flags(ctx) & IFC_IN_DETACH) == 0)
|
||||
return (EBUSY);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static device_t iflib_pseudodev;
|
||||
|
|
Loading…
Reference in a new issue