lkml.org 
[lkml]   [2016]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 2/8] lib/test_firmware.c: use late_initcall()
Date
When expanding test coverage of firmware_class with the sysdata
API test driver we get a crash when CONFIG_TEST_FIRMWARE=y,
only a combination produces a panic however. This fixes it.

------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at lib/kobject.c:597 kobject_get+0x4d/0x80
kobject: '(null)' (ffffea0000722850): is not initialized, yet kobject_get() is being called.
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc3-1-default+ #127
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS by qemu-project.org 04/01/2014
0000000000000000 ffff88001e223c48 ffffffff813948c1 ffff88001e223c98
0000000000000000 ffff88001e223c88 ffffffff8107eecb 00000255024080c0
ffff88001f837810 ffffea0000722840 0000000000000000 ffff88001f837800
Call Trace:
[<ffffffff813948c1>] dump_stack+0x63/0x82
[<ffffffff8107eecb>] __warn+0xcb/0xf0
[<ffffffff8107ef3f>] warn_slowpath_fmt+0x4f/0x60
[<ffffffff814d6783>] ? device_private_init+0x23/0x70
[<ffffffff81396cdd>] kobject_get+0x4d/0x80
[<ffffffff814d68aa>] device_add+0xda/0x680
[<ffffffff814d7040>] device_create_groups_vargs+0xe0/0xf0
[<ffffffff81d82675>] ? test_firmware_init+0xb2/0xb2
[<ffffffff814d70f6>] device_create_with_groups+0x36/0x40
[<ffffffff813ae6d1>] ? test_dev_get_name+0x91/0xd0
[<ffffffff814ad3d5>] misc_register+0x145/0x180
[<ffffffff81d826a8>] test_sysdata_init+0x33/0xc8
[<ffffffff81002123>] do_one_initcall+0xb3/0x200
[<ffffffff8109d805>] ? parse_args+0x295/0x4b0
[<ffffffff81d3e12b>] kernel_init_freeable+0x183/0x20e
[<ffffffff816a1ace>] kernel_init+0xe/0x100
[<ffffffff816af062>] ret_from_fork+0x22/0x40
[<ffffffff816a1ac0>] ? rest_init+0x90/0x90
---[ end trace 3779de9087657326 ]---
------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at lib/kobject.c:597 kobject_get+0x4d/0x80
kobject: '(null)' (ffffea0000722850): is not initialized, yet kobject_get() is being called.
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 4.6.0-rc3-1-default+ #127
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS by qemu-project.org 04/01/2014
0000000000000000 ffff88001e223b70 ffffffff813948c1 ffff88001e223bc0
0000000000000000 ffff88001e223bb0 ffffffff8107eecb 00000255816af7cb
ffff88001f80c400 0000000000000000 ffffea0000722850 ffff88001f836800
Call Trace:
[<ffffffff813948c1>] dump_stack+0x63/0x82
[<ffffffff8107eecb>] __warn+0xcb/0xf0
[<ffffffff8107ef3f>] warn_slowpath_fmt+0x4f/0x60
[<ffffffff813a90e5>] ? find_next_bit+0x15/0x20
[<ffffffff81396cdd>] kobject_get+0x4d/0x80
[<ffffffff81397629>] kobject_add_internal+0x39/0x340
[<ffffffff811a9512>] ? kfree_const+0x22/0x30
[<ffffffff81397998>] kobject_add+0x68/0xb0
[<ffffffff8107ef3f>] ? warn_slowpath_fmt+0x4f/0x60
[<ffffffff814d5b3d>] get_device_parent.isra.19+0x10d/0x1d0
[<ffffffff814d68c1>] device_add+0xf1/0x680
[<ffffffff814d7040>] device_create_groups_vargs+0xe0/0xf0
[<ffffffff81d82675>] ? test_firmware_init+0xb2/0xb2
[<ffffffff814d70f6>] device_create_with_groups+0x36/0x40
[<ffffffff813ae6d1>] ? test_dev_get_name+0x91/0xd0
[<ffffffff814ad3d5>] misc_register+0x145/0x180
[<ffffffff81d826a8>] test_sysdata_init+0x33/0xc8
[<ffffffff81002123>] do_one_initcall+0xb3/0x200
[<ffffffff8109d805>] ? parse_args+0x295/0x4b0
[<ffffffff81d3e12b>] kernel_init_freeable+0x183/0x20e
[<ffffffff816a1ace>] kernel_init+0xe/0x100
[<ffffffff816af062>] ret_from_fork+0x22/0x40
[<ffffffff816a1ac0>] ? rest_init+0x90/0x90
---[ end trace 3779de9087657327 ]---
general protection fault: 0000 [#1] PREEMPT SMP

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
---
lib/test_firmware.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_firmware.c b/lib/test_firmware.c
index a3e8ec3fb1c5..5f087a03e5f7 100644
--- a/lib/test_firmware.c
+++ b/lib/test_firmware.c
@@ -167,7 +167,7 @@ dereg:
return rc;
}

-module_init(test_firmware_init);
+late_initcall(test_firmware_init);

static void __exit test_firmware_exit(void)
{
--
2.8.2
\
 
 \ /
  Last update: 2016-06-17 02:41    [W:0.154 / U:7.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site