network stack: move put_device_interface() at the end of the Interface destructor.

Fixes #10919.

Removing an interface triggers this sequence:

datalink_control() calls interface->ReleaseReference() which causes the
Interface destructor to be called. The Interface destructor calls
put_device_interface(fDeviceInterface) which destroys the
net_device_interface, then calls put_domain_datalink_protocols(this, datalink->domain)
in a loop. put_domain_datalink_protocols() tries to access the deleted
net_device_interface, hence the KDL.

Change-Id: I2326bcd6d1fd80a69e5fdfa6629563b38ecdbbac
Reviewed-on: https://review.haiku-os.org/469
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
JackBurton79
2018-08-23 06:36:11 +00:00
committed by Stefano Ceccherini
parent 1147b9a49d
commit 9923dd5ce5
@@ -482,8 +482,6 @@ Interface::~Interface()
{
TRACE("Interface %p: destructor\n", this);
put_device_interface(fDeviceInterface);
// Uninitialize the domain datalink protocols
DatalinkTable::Iterator iterator = fDatalinkTable.GetIterator();
@@ -501,6 +499,8 @@ Interface::~Interface()
delete datalink;
}
put_device_interface(fDeviceInterface);
recursive_lock_destroy(&fLock);
// Release reference of the stack - at this point, our stack may be unloaded