lkml.org 
[lkml]   [2013]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
SubjectRe: [patch] module: potential deadlock in error path
On Sun, Jan 20, 2013 at 5:20 PM, Rusty Russell <rusty@rustcorp.com.au> wrote:
> Dan Carpenter <dan.carpenter@oracle.com> writes:
>> We take the lock twice if we hit this goto.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> Damn, just pushed that to Linus: should have read mail first.
>
> I've added this, thanks.

I'm not pulling this. It seems stupid.

Why isn't the fix just this (whitespace-damaged, cut-and-pasted)
one-liner instead? I may be blind, but as far as I cal tell, there's
exactly one single place we do that "giti ddebug_cleanup", and it
wants to unlock the mutex, so we should just move the unlock down one
line instead.

Hmm? Is there some hidden magic going on that I can't see?

Linus

---
diff --git a/kernel/module.c b/kernel/module.c
index d25e359279ae..eab08274ec9b 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3274,8 +3274,8 @@ again:
/* module_bug_cleanup needs module_mutex protection */
mutex_lock(&module_mutex);
module_bug_cleanup(mod);
- mutex_unlock(&module_mutex);
ddebug_cleanup:
+ mutex_unlock(&module_mutex);
dynamic_debug_remove(info->debug);
synchronize_sched();
kfree(mod->args);

\
 
 \ /
  Last update: 2013-01-21 03:41    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog