If linker_release_module() fails then we still hold a reference on

the linker_file, so record this by restoring the linker_file pointer
in fp->file.
This commit is contained in:
Ian Dowse 2006-06-25 12:36:21 +00:00
parent dacf5a7a79
commit 450ec4ed45
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159924

View File

@ -205,7 +205,7 @@ unloadentry(void *unused1, int unused2)
{
struct firmware *fp;
linker_file_t file;
int i;
int i, err;
mtx_lock(&firmware_mtx);
for (;;) {
@ -225,9 +225,19 @@ unloadentry(void *unused1, int unused2)
fp->file = NULL;
mtx_unlock(&firmware_mtx);
linker_release_module(NULL, NULL, file);
err = linker_release_module(NULL, NULL, file);
mtx_lock(&firmware_mtx);
if (err) {
/*
* If linker_release_module() failed then we still
* hold a reference on the module so it should not be
* possible for it to go away or be re-registered.
*/
KASSERT(fp->file == NULL,
("firmware entry reused while referenced!"));
fp->file = file;
}
}
mtx_unlock(&firmware_mtx);
}