Release the vnode lock and close the linker file vnode earlier in
the linker_load_file methods. The change is that the consequent linker_file_unload() call is not under the vnode lock anymore. This prevents the LOR between kernel linker sx xlock and vnode lock, because linker_file_unload() relocks kernel linker lock. MFC after: 2 weeks
This commit is contained in:
parent
fec07a7df1
commit
f1d2d3052a
@ -967,15 +967,15 @@ nosyms:
|
|||||||
*result = lf;
|
*result = lf;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
VOP_UNLOCK(nd.ni_vp, 0);
|
||||||
|
vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
|
||||||
|
VFS_UNLOCK_GIANT(vfslocked);
|
||||||
if (error && lf)
|
if (error && lf)
|
||||||
linker_file_unload(lf, LINKER_UNLOAD_FORCE);
|
linker_file_unload(lf, LINKER_UNLOAD_FORCE);
|
||||||
if (shdr)
|
if (shdr)
|
||||||
free(shdr, M_LINKER);
|
free(shdr, M_LINKER);
|
||||||
if (firstpage)
|
if (firstpage)
|
||||||
free(firstpage, M_LINKER);
|
free(firstpage, M_LINKER);
|
||||||
VOP_UNLOCK(nd.ni_vp, 0);
|
|
||||||
vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
|
|
||||||
VFS_UNLOCK_GIANT(vfslocked);
|
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -885,13 +885,13 @@ link_elf_load_file(linker_class_t cls, const char *filename,
|
|||||||
*result = lf;
|
*result = lf;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
VOP_UNLOCK(nd.ni_vp, 0);
|
||||||
|
vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
|
||||||
|
VFS_UNLOCK_GIANT(vfslocked);
|
||||||
if (error && lf)
|
if (error && lf)
|
||||||
linker_file_unload(lf, LINKER_UNLOAD_FORCE);
|
linker_file_unload(lf, LINKER_UNLOAD_FORCE);
|
||||||
if (hdr)
|
if (hdr)
|
||||||
free(hdr, M_LINKER);
|
free(hdr, M_LINKER);
|
||||||
VOP_UNLOCK(nd.ni_vp, 0);
|
|
||||||
vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
|
|
||||||
VFS_UNLOCK_GIANT(vfslocked);
|
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user