* Fixed possible deadlock when booting over the network. Creating the interface

without having the domain locked seems to be safe AFAICT.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27839 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-10-02 09:16:50 +00:00
parent 4787aab961
commit a3513e7b9a
+14 -4
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved. * Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -168,11 +168,21 @@ add_interface_to_domain(net_domain *_domain,
net_interface_private *interface = NULL; net_interface_private *interface = NULL;
status_t status; status_t status;
if (find_interface(domain, request.ifr_name) != NULL) if (find_interface(domain, request.ifr_name) == NULL) {
status = B_NAME_IN_USE; // We must not hold the domain's link when creating the interface:
else // this will call get_module() which might want to access a network
// device when booting from network.
locker.Unlock();
status = create_interface(domain, request.ifr_name, status = create_interface(domain, request.ifr_name,
baseName, deviceInterface, &interface); baseName, deviceInterface, &interface);
locker.Lock();
if (find_interface(domain, request.ifr_name) != NULL) {
delete_interface(interface);
status = B_NAME_IN_USE;
}
} else
status = B_NAME_IN_USE;
put_device_interface(deviceInterface); put_device_interface(deviceInterface);