public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Arnd Bergmann <arnd@arndb.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Kay Sievers <kay.sievers@vrfy.org>,
	Brandon Philips <brandon@ifup.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [BUG 2.6.36-rc6] list corruption in module_bug_finalize
Date: Tue, 5 Oct 2010 15:44:51 +1030	[thread overview]
Message-ID: <201010051544.52269.rusty@rustcorp.com.au> (raw)
In-Reply-To: <alpine.LFD.2.00.1010050026170.2556@localhost6.localdomain6>

On Tue, 5 Oct 2010 09:13:38 am Thomas Gleixner wrote:
> The patch below cures it.

Using module_mutex here is just lazy...  Here's 5c, go buy your own lock :)

>  	/*
> -	 * Strictly speaking this should have a spinlock to protect against
> -	 * traversals, but since we only traverse on BUG()s, a spinlock
> -	 * could potentially lead to deadlock and thus be counter-productive.
> +	 * We need to take module_mutex here to protect the list add, though
> +	 * it won't protect against a concurrent BUG().
>  	 */
> +	mutex_lock(&module_mutex);
>  	list_add(&mod->bug_list, &module_bug_list);
> +	mutex_unlock(&module_mutex);
>  
>  	return 0;
>  }
>  
>  void module_bug_cleanup(struct module *mod)
>  {
> +	mutex_lock(&module_mutex);
>  	list_del(&mod->bug_list);
> +	mutex_unlock(&module_mutex);
>  }
>  
>  #else
> 

  parent reply	other threads:[~2010-10-05  5:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-03 19:51 [BUG 2.6.36-rc6] list corruption in module_bug_finalize Thomas Gleixner
2010-10-04 11:00 ` Arnd Bergmann
2010-10-04 22:43   ` Thomas Gleixner
2010-10-04 23:55     ` Linus Torvalds
2010-10-05  1:11       ` Linus Torvalds
2010-10-05  5:14     ` Rusty Russell [this message]
2010-10-05  7:30       ` Thomas Gleixner
2010-10-05 15:34         ` Linus Torvalds
2010-10-05 16:40           ` Thomas Gleixner
2010-10-05 17:17             ` Linus Torvalds
2010-10-05 17:43               ` Thomas Gleixner
2010-10-06  9:10                 ` Rusty Russell
2010-10-05  4:18 ` Rusty Russell
2010-10-05 11:08   ` Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201010051544.52269.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=arnd@arndb.de \
    --cc=brandon@ifup.org \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox