Reversed locking order of sImageLoadMutex and sImageMutex in
unload_kernel_add_on(). The former one could lead to deadlocks with load_kernel_add_on() (e.g. occasionally the boot process would hang). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20485 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
c798dceb5a
commit
6e442c70cb
@ -54,8 +54,9 @@ typedef struct elf_linked_image {
|
||||
static hash_table *sImagesHash;
|
||||
|
||||
static struct elf_image_info *sKernelImage = NULL;
|
||||
static mutex sImageMutex;
|
||||
static mutex sImageLoadMutex;
|
||||
static mutex sImageMutex; // guards sImagesHash
|
||||
static mutex sImageLoadMutex; // serializes loading/unloading add-ons
|
||||
// locking order sImageLoadMutex -> sImageMutex
|
||||
static bool sInitialized = false;
|
||||
|
||||
|
||||
@ -1449,19 +1450,18 @@ unload_kernel_add_on(image_id id)
|
||||
struct elf_image_info *image;
|
||||
status_t status;
|
||||
|
||||
mutex_lock(&sImageLoadMutex);
|
||||
mutex_lock(&sImageMutex);
|
||||
|
||||
image = find_image(id);
|
||||
if (image != NULL) {
|
||||
mutex_lock(&sImageLoadMutex);
|
||||
|
||||
if (image != NULL)
|
||||
status = unload_elf_image(image);
|
||||
|
||||
mutex_unlock(&sImageLoadMutex);
|
||||
} else
|
||||
else
|
||||
status = B_BAD_IMAGE_ID;
|
||||
|
||||
mutex_unlock(&sImageMutex);
|
||||
mutex_unlock(&sImageLoadMutex);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user