Calling linker_load_dependencies() while holding the module'

vnode lock may cause a LOR between kld_sx lock and vnode lock.
linker_load_dependencies() drops kld_sx, and another thread may attempt
to load the same kld.

Reported and tested by:	pjd
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2008-08-03 13:33:45 +00:00
parent 200d80cd74
commit 4f7afc20e0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=181235
2 changed files with 4 additions and 0 deletions

View File

@ -802,7 +802,9 @@ link_elf_load_file(linker_class_t cls, const char* filename,
goto out;
link_elf_reloc_local(lf);
VOP_UNLOCK(nd.ni_vp, 0);
error = linker_load_dependencies(lf);
vn_lock(nd.ni_vp, LK_EXCLUSIVE | LK_RETRY);
if (error)
goto out;
#if 0 /* this will be more trouble than it's worth for now */

View File

@ -798,7 +798,9 @@ link_elf_load_file(linker_class_t cls, const char *filename,
link_elf_reloc_local(lf);
/* Pull in dependencies */
VOP_UNLOCK(nd.ni_vp, 0);
error = linker_load_dependencies(lf);
vn_lock(nd.ni_vp, LK_EXCLUSIVE | LK_RETRY);
if (error)
goto out;