summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/base/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/base/module.c')
-rw-r--r--kernel/drivers/base/module.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/drivers/base/module.c b/kernel/drivers/base/module.c
index db930d3ee..2a215780e 100644
--- a/kernel/drivers/base/module.c
+++ b/kernel/drivers/base/module.c
@@ -24,10 +24,12 @@ static char *make_driver_name(struct device_driver *drv)
static void module_create_drivers_dir(struct module_kobject *mk)
{
- if (!mk || mk->drivers_dir)
- return;
+ static DEFINE_MUTEX(drivers_dir_mutex);
- mk->drivers_dir = kobject_create_and_add("drivers", &mk->kobj);
+ mutex_lock(&drivers_dir_mutex);
+ if (mk && !mk->drivers_dir)
+ mk->drivers_dir = kobject_create_and_add("drivers", &mk->kobj);
+ mutex_unlock(&drivers_dir_mutex);
}
void module_add_driver(struct module *mod, struct device_driver *drv)