diff options
author | kib <kib@FreeBSD.org> | 2008-08-03 13:33:45 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2008-08-03 13:33:45 +0000 |
commit | 52aa4f35d0227eddf0791072be3baac35944788a (patch) | |
tree | 7603ee0923284048aefc51b770a8cdbd676830f7 | |
parent | 7237d2d9a2e1a1f1f650979348ff92f8e2c449dd (diff) | |
download | FreeBSD-src-52aa4f35d0227eddf0791072be3baac35944788a.zip FreeBSD-src-52aa4f35d0227eddf0791072be3baac35944788a.tar.gz |
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
-rw-r--r-- | sys/kern/link_elf.c | 2 | ||||
-rw-r--r-- | sys/kern/link_elf_obj.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 2664ba9..52b3f8f 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -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 */ diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index d8e9219..29165fe 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -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; |