aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_linker.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_linker.c')
-rw-r--r--sys/kern/kern_linker.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index 70a49d7d0f56..682bb9aae0d5 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -2079,13 +2079,15 @@ linker_load_module(const char *kldname, const char *modname,
*/
KASSERT(verinfo == NULL, ("linker_load_module: verinfo"
" is not NULL"));
- if (rootvnode == NULL)
+ /* check if root file system is not mounted */
+ if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL)
return (ENXIO);
pathname = linker_search_kld(kldname);
} else {
if (modlist_lookup2(modname, verinfo) != NULL)
return (EEXIST);
- if (rootvnode == NULL)
+ /* check if root file system is not mounted */
+ if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL)
return (ENXIO);
if (kldname != NULL)
pathname = strdup(kldname, M_LINKER);