From 292e0056ea51b87d901f765b4c35dd85d5589935 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Tue, 22 Jan 2013 16:48:03 -0800 Subject: [PATCH] --- yaml --- r: 350308 b: refs/heads/master c: 0fdff3ec6d87856cdcc99e69cf42143fdd6c56b4 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/kernel/kmod.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 1b805695312b..f32b5ea2539d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 21c3c5d2800733b7a276725b8e1ae49a694adc1a +refs/heads/master: 0fdff3ec6d87856cdcc99e69cf42143fdd6c56b4 diff --git a/trunk/kernel/kmod.c b/trunk/kernel/kmod.c index 1c317e386831..ecd42b484db8 100644 --- a/trunk/kernel/kmod.c +++ b/trunk/kernel/kmod.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -130,6 +131,14 @@ int __request_module(bool wait, const char *fmt, ...) #define MAX_KMOD_CONCURRENT 50 /* Completely arbitrary value - KAO */ static int kmod_loop_msg; + /* + * We don't allow synchronous module loading from async. Module + * init may invoke async_synchronize_full() which will end up + * waiting for this task which already is waiting for the module + * loading to complete, leading to a deadlock. + */ + WARN_ON_ONCE(wait && current_is_async()); + va_start(args, fmt); ret = vsnprintf(module_name, MODULE_NAME_LEN, fmt, args); va_end(args);