Re: sysfs lockdep complaint
From: AmÃrico Wang
Date: Sat Feb 20 2010 - 10:13:37 EST
On Sat, Feb 20, 2010 at 02:58:11PM +0100, Johannes Berg wrote:
>On Sat, 2010-02-20 at 21:51 +0800, AmÃrico Wang wrote:
>
>> >BUG: key c0000002165eb478 not in .data!
>> >
>> >instead of the lockdep complaint above.
>> >
>>
>> I am not surprised. :)
>>
>> Please send us the backtraces you got, we could expect this.
>
>I hacked in dump_stack() but it overflowed my log buffer, here's an example:
>
>[ 31.625411] BUG: key c0000002134f2ab0 not in .data!
>[ 31.625414] Call Trace:
>[ 31.625417] [c000000213b677c0] [c000000000012c1c] .show_stack+0xc0/0x200 (unreliable)
>[ 31.625423] [c000000213b67890] [c0000000005ac968] .dump_stack+0x28/0x3c
>[ 31.625428] [c000000213b67910] [c0000000000b6a3c] .lockdep_init_map+0x11c/0x674
>[ 31.625433] [c000000213b67a10] [c0000000001efd90] .sysfs_add_file_mode+0x90/0x124
>[ 31.625438] [c000000213b67ad0] [c0000000001efe60] .sysfs_add_file+0x3c/0x50
>[ 31.625442] [c000000213b67b70] [c0000000001f2f40] .sysfs_create_bin_file+0x5c/0x78
>[ 31.625448] [c000000213b67c10] [c0000000000cd0b0] .load_module+0x16a4/0x197c
>[ 31.625452] [c000000213b67d80] [c0000000000cd424] .SyS_init_module+0x9c/0x2d4
>[ 31.625457] [c000000213b67e30] [c0000000000075d4] syscall_exit+0x0/0x40
>
>There's also
>[ 34.776604] BUG: key c000000216265388 not in .data!
>[ 34.776606] Call Trace:
>[ 34.776609] [c000000213b5f7a0] [c000000000012c1c] .show_stack+0xc0/0x200 (unreliable)
>[ 34.776615] [c000000213b5f870] [c0000000005ac968] .dump_stack+0x28/0x3c
>[ 34.776620] [c000000213b5f8f0] [c0000000000b6a3c] .lockdep_init_map+0x11c/0x674
>[ 34.776624] [c000000213b5f9f0] [c0000000001efd90] .sysfs_add_file_mode+0x90/0x124
>[ 34.776629] [c000000213b5fab0] [c0000000001f32b4] .internal_create_group+0x168/0x24c
>[ 34.776634] [c000000213b5fb70] [c0000000001f3420] .sysfs_create_group+0x38/0x50
>[ 34.776639] [c000000213b5fc10] [c0000000000ccf20] .load_module+0x1514/0x197c
>[ 34.776644] [c000000213b5fd80] [c0000000000cd424] .SyS_init_module+0x9c/0x2d4
>[ 34.776649] [c000000213b5fe30] [c0000000000075d4] syscall_exit+0x0/0x40
>
Thanks!
This could be fixed by the following.
Reported-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
Signed-off-by: WANG Cong <xiyou.wangcong@xxxxxxxxx>
---
diff --git a/kernel/module.c b/kernel/module.c
index f82386b..fa4d562 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1085,6 +1085,7 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
sect_attrs->nsections++;
sattr->mattr.show = module_sect_show;
sattr->mattr.store = NULL;
+ sysfs_attr_init(&sattr->mattr.attr);
sattr->mattr.attr.name = sattr->name;
sattr->mattr.attr.mode = S_IRUGO;
*(gattr++) = &(sattr++)->mattr.attr;
@@ -1178,6 +1179,7 @@ static void add_notes_attrs(struct module *mod, unsigned int nsect,
if (sect_empty(&sechdrs[i]))
continue;
if (sechdrs[i].sh_type == SHT_NOTE) {
+ sysfs_bin_attr_init(nattr);
nattr->attr.name = mod->sect_attrs->attrs[loaded].name;
nattr->attr.mode = S_IRUGO;
nattr->size = sechdrs[i].sh_size;
--
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/