Fix panic on e.g. "kldload /dev/null".

PR:		kern/121427
Reviewed by:	sem
MFC after:	3 days
This commit is contained in:
Ruslan Ermilov 2008-03-15 17:40:18 +00:00
parent 409e319377
commit 1f49b573e1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177228
2 changed files with 9 additions and 0 deletions

View File

@ -571,6 +571,11 @@ link_elf_load_file(linker_class_t cls, const char* filename,
return error;
vfslocked = NDHASGIANT(&nd);
NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_vp->v_type != VREG) {
error = ENOEXEC;
firstpage = NULL;
goto out;
}
#ifdef MAC
error = mac_kld_check_load(curthread->td_ucred, nd.ni_vp);
if (error) {

View File

@ -409,6 +409,10 @@ link_elf_load_file(linker_class_t cls, const char *filename,
return error;
vfslocked = NDHASGIANT(&nd);
NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_vp->v_type != VREG) {
error = ENOEXEC;
goto out;
}
#ifdef MAC
error = mac_kld_check_load(td->td_ucred, nd.ni_vp);
if (error) {