Make the consumers of the linker_load_file() function use
linker_load_module() instead. This fixes a bug where the kernel was unable to properly locate and load a kernel module in vfs_mount() (and probably in the netgraph code as well since it was using the same function). This is because the linker_load_file() does not properly search the module path. Problem found by: peter Reviewed by: peter Thanks to: peter
This commit is contained in:
parent
4b32dfdcd7
commit
f2b17113cf
@ -57,9 +57,6 @@ int kld_debug = 0;
|
||||
* *verinfo);
|
||||
*/
|
||||
static const char *linker_basename(const char *path);
|
||||
static int linker_load_module(const char *kldname, const char *modname,
|
||||
struct linker_file *parent, struct mod_depend *verinfo,
|
||||
struct linker_file **lfpp);
|
||||
|
||||
/* Metadata from the static kernel */
|
||||
SET_DECLARE(modmetadata_set, struct mod_metadata);
|
||||
@ -314,7 +311,7 @@ linker_init_kernel_modules(void)
|
||||
|
||||
SYSINIT(linker_kernel, SI_SUB_KLD, SI_ORDER_ANY, linker_init_kernel_modules, 0)
|
||||
|
||||
int
|
||||
static int
|
||||
linker_load_file(const char *filename, linker_file_t *result)
|
||||
{
|
||||
linker_class_t lc;
|
||||
@ -1626,7 +1623,7 @@ linker_basename(const char *path)
|
||||
* Find a file which contains given module and load it, if "parent" is not
|
||||
* NULL, register a reference to it.
|
||||
*/
|
||||
static int
|
||||
int
|
||||
linker_load_module(const char *kldname, const char *modname,
|
||||
struct linker_file *parent, struct mod_depend *verinfo,
|
||||
struct linker_file **lfpp)
|
||||
|
@ -596,7 +596,7 @@ vfs_nmount(td, fsflags, fsoptions)
|
||||
vput(vp);
|
||||
goto bad;
|
||||
}
|
||||
error = linker_load_file(fstype, &lf);
|
||||
error = linker_load_module(NULL, fstype, NULL, NULL, &lf);
|
||||
if (error || lf == NULL) {
|
||||
vput(vp);
|
||||
if (lf == NULL)
|
||||
@ -964,7 +964,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata)
|
||||
vput(vp);
|
||||
return (error);
|
||||
}
|
||||
error = linker_load_file(fstype, &lf);
|
||||
error = linker_load_module(NULL, fstype, NULL, NULL, &lf);
|
||||
if (error || lf == NULL) {
|
||||
vput(vp);
|
||||
if (lf == NULL)
|
||||
|
@ -556,7 +556,7 @@ ng_make_node(const char *typename, node_p *nodepp)
|
||||
|
||||
/* Not found, try to load it as a loadable module */
|
||||
snprintf(filename, sizeof(filename), "ng_%s", typename);
|
||||
error = linker_load_file(filename, &lf);
|
||||
error = linker_load_module(NULL, filename, NULL, NULL, &lf);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
lf->userrefs++; /* pretend loaded by the syscall */
|
||||
|
@ -105,9 +105,11 @@ extern linker_file_t linker_kernel_file;
|
||||
int linker_add_class(linker_class_t _cls);
|
||||
|
||||
/*
|
||||
* Load a file, trying each file class until one succeeds.
|
||||
* Load a kernel module.
|
||||
*/
|
||||
int linker_load_file(const char* _filename, linker_file_t* _result);
|
||||
int linker_load_module(const char *_kldname, const char *_modname,
|
||||
struct linker_file *_parent, struct mod_depend *_verinfo,
|
||||
struct linker_file **_lfpp);
|
||||
|
||||
/*
|
||||
* Obtain a reference to a module, loading it if required.
|
||||
|
Loading…
Reference in New Issue
Block a user