Date: Thu, 28 Nov 2019 08:47:36 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355170 - head/sys/kern Message-ID: <201911280847.xAS8laZR049542@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Thu Nov 28 08:47:36 2019 New Revision: 355170 URL: https://svnweb.freebsd.org/changeset/base/355170 Log: Factor out check for mounted root file system. Differential Revision: https://reviews.freebsd.org/D22571 PR: 241639 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/kern/kern_linker.c head/sys/kern/subr_firmware.c Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Thu Nov 28 07:49:25 2019 (r355169) +++ head/sys/kern/kern_linker.c Thu Nov 28 08:47:36 2019 (r355170) @@ -2079,13 +2079,15 @@ linker_load_module(const char *kldname, const char *mo */ 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); Modified: head/sys/kern/subr_firmware.c ============================================================================== --- head/sys/kern/subr_firmware.c Thu Nov 28 07:49:25 2019 (r355169) +++ head/sys/kern/subr_firmware.c Thu Nov 28 08:47:36 2019 (r355170) @@ -257,7 +257,6 @@ firmware_unregister(const char *imagename) static void loadimage(void *arg, int npending) { - struct thread *td = curthread; char *imagename = arg; struct priv_fw *fp; linker_file_t result; @@ -267,11 +266,6 @@ loadimage(void *arg, int npending) mtx_lock(&firmware_mtx); mtx_unlock(&firmware_mtx); - if (td->td_proc->p_fd->fd_rdir == NULL) { - printf("%s: root not mounted yet, no way to load image\n", - imagename); - goto done; - } error = linker_reference_module(imagename, NULL, &result); if (error != 0) { printf("%s: could not load firmware image, error %d\n",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911280847.xAS8laZR049542>