Date: Tue, 26 Nov 2019 12:20:44 +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: r355108 - head/sys/kern Message-ID: <201911261220.xAQCKi3b068073@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Tue Nov 26 12:20:44 2019 New Revision: 355108 URL: https://svnweb.freebsd.org/changeset/base/355108 Log: Fix panic when loading kernel modules before root file system is mounted. Make sure the rootvnode is always NULL checked. Differential Revision: https://reviews.freebsd.org/D22545 PR: 241639 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/kern/kern_linker.c Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Tue Nov 26 05:54:25 2019 (r355107) +++ head/sys/kern/kern_linker.c Tue Nov 26 12:20:44 2019 (r355108) @@ -2079,14 +2079,16 @@ linker_load_module(const char *kldname, const char *mo */ KASSERT(verinfo == NULL, ("linker_load_module: verinfo" " is not NULL")); + if (rootvnode == NULL) + return (ENXIO); pathname = linker_search_kld(kldname); } else { if (modlist_lookup2(modname, verinfo) != NULL) return (EEXIST); + if (rootvnode == NULL) + return (ENXIO); if (kldname != NULL) pathname = strdup(kldname, M_LINKER); - else if (rootvnode == NULL) - pathname = NULL; else /* * Need to find a KLD with required module
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911261220.xAQCKi3b068073>