summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_base.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2004-07-27 20:30:56 +0000
committerglebius <glebius@FreeBSD.org>2004-07-27 20:30:56 +0000
commit1a302abfe10a4008193863aa28d2f3bff8a91b19 (patch)
treeeacfbebb8ab24714d31e2956f059a1feae6822b7 /sys/netgraph/ng_base.c
parentb050f5c62b8c2eb737e52df3b4c97fdd01b72cb0 (diff)
downloadFreeBSD-src-1a302abfe10a4008193863aa28d2f3bff8a91b19.zip
FreeBSD-src-1a302abfe10a4008193863aa28d2f3bff8a91b19.tar.gz
When making a peer of unknown type framework tries to load module
using linker_load_module(). This works OK if NGM_MKPEER message came from userland and we have process associated with thread. But when NGM_MKPEER was queued because target node was busy, linker_load_module() is called from netisr thread leading to panic. To workaround that we do not load modules by framework, instead ng_socket loads module (if this is required) before sending NGM_MKPEER. However, the race condition between return from NgSendMsg() and actual creation of node still exist and needs to be solved. PR: kern/62789 Approved by: julian
Diffstat (limited to 'sys/netgraph/ng_base.c')
-rw-r--r--sys/netgraph/ng_base.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
index 74032a5..601ac9b 100644
--- a/sys/netgraph/ng_base.c
+++ b/sys/netgraph/ng_base.c
@@ -53,7 +53,6 @@
#include <sys/malloc.h>
#include <sys/syslog.h>
#include <sys/sysctl.h>
-#include <sys/linker.h>
#include <sys/queue.h>
#include <sys/mbuf.h>
#include <sys/ctype.h>
@@ -205,7 +204,6 @@ void ng_destroy_hook(hook_p hook);
node_p ng_name2noderef(node_p node, const char *name);
int ng_path2noderef(node_p here, const char *path,
node_p *dest, hook_p *lasthook);
-struct ng_type *ng_findtype(const char *type);
int ng_make_node(const char *type, node_p *nodepp);
int ng_path_parse(char *addr, char **node, char **path, char **hook);
void ng_rmnode(node_p node, hook_p dummy1, void *dummy2, int dummy3);
@@ -547,23 +545,11 @@ ng_make_node(const char *typename, node_p *nodepp)
return (EINVAL);
}
- /* Locate the node type */
- if ((type = ng_findtype(typename)) == NULL) {
- char filename[NG_TYPESIZ + 3];
- linker_file_t lf;
- int error;
-
- /* Not found, try to load it as a loadable module */
- snprintf(filename, sizeof(filename), "ng_%s", typename);
- error = linker_load_module(NULL, filename, NULL, NULL, &lf);
- if (error != 0)
- return (error);
- lf->userrefs++; /* pretend loaded by the syscall */
-
- /* Try again, as now the type should have linked itself in */
- if ((type = ng_findtype(typename)) == NULL)
- return (ENXIO);
- }
+ /* Locate the node type. If we fail we return. Do not try to load
+ * module.
+ */
+ if ((type = ng_findtype(typename)) == NULL)
+ return (ENXIO);
/*
* If we have a constructor, then make the node and
OpenPOWER on IntegriCloud