Re: [BUG 2.6.36-rc6] list corruption in module_bug_finalize

From: Rusty Russell
Date: Tue Oct 05 2010 - 01:15:04 EST


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
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/