i2c: remove __init from i2c_register_board_info()
Subsystems (3)
PATCH 1/1 i2c: remove __init from i2c_register_board_info()
As of next-20160607 with allyesconfig we get this linker failure:
MODPOST vmlinux.o
WARNING: vmlinux.o(.text+0x21bc0d): Section mismatch in reference from the function intel_scu_devices_create() to the function .init.text:i2c_register_board_info()
This is caused by the fact that intel_scu_devices_create() calls i2c_register_board_info() and intel_scu_devices_create() is not annotated with __init. This typically involves manual code inspection and if one is certain this is correct we would just peg intel_scu_devices_create() with a __ref annotation.
In this case this would be wrong though as the intel_scu_devices_create() call is exported, and used in the ipc_probe() on drivers/platform/x86/intel_scu_ipc.c. The issue is that even though builtin_pci_driver(ipc_driver) is used this just exposes the probe routine, which can occur at any point in time if this bus supports hotplug. A race can happen between kernel_init_freeable() that calls the init calls (in this case registeres the intel_scu_ipc.c driver, and later free_initmem(), which would free the i2c_register_board_info(). If a probe happens later in boot i2c_register_board_info() would not be present and we should get a page fault.
--- drivers/i2c/i2c-boardinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/i2c-boardinfo.c +1 -1
@@ -56,7 +56,7 @@ EXPORT_SYMBOL_GPL(__i2c_first_dynamic_bus_num);* The board info passed can safely be __initdata, but be careful of embedded * pointers (for platform_data, functions, etc) since that won't be copied. */ -int __init +int i2c_register_board_info (int busnum,struct i2c_board_info const *info,unsigned len) {
Signature · 1 line
2.8.1
Quoted 25 lines · Luis R. Rodriguez
As of next-20160607 with allyesconfig we get this linker failure:
MODPOST vmlinux.o
WARNING:vmlinux.o(.text+0x21bc0d): Section mismatch in reference from the functionintel_scu_devices_create()to the function .init.text:i2c_register_board_info()This is caused by the fact that
intel_scu_devices_create()callsi2c_register_board_info()andintel_scu_devices_create()is not annotated with__init. This typically involves manual code inspection and if one is certain this is correct we would just pegintel_scu_devices_create()with a__refannotation.In this case this would be wrong though as the
intel_scu_devices_create()call is exported, and used in theipc_probe()ondrivers/platform/x86/intel_scu_ipc.c. The issue is that even thoughbuiltin_pci_driver(ipc_driver)is used this just exposes the probe routine, which can occur at any point in time if this bus supports hotplug. A race can happen betweenkernel_init_freeable()that calls the init calls (in this case registeres theintel_scu_ipc.cdriver, and laterfree_initmem(), which would free thei2c_register_board_info(). If a probe happens later in booti2c_register_board_info()would not be present and we should get a page fault.
Quoted 1 line
Signed-off-by Luis R. Rodriguez <[email protected]>
I don't see this merged yet on linux-next and this is still an issue.
*Poke*
Luis
Quoted 25 lines · Luis R. Rodriguez
As of next-20160607 with allyesconfig we get this linker failure:
MODPOST vmlinux.o
WARNING:vmlinux.o(.text+0x21bc0d): Section mismatch in reference from the functionintel_scu_devices_create()to the function .init.text:i2c_register_board_info()This is caused by the fact that
intel_scu_devices_create()callsi2c_register_board_info()andintel_scu_devices_create()is not annotated with__init. This typically involves manual code inspection and if one is certain this is correct we would just pegintel_scu_devices_create()with a__refannotation.In this case this would be wrong though as the
intel_scu_devices_create()call is exported, and used in theipc_probe()ondrivers/platform/x86/intel_scu_ipc.c. The issue is that even thoughbuiltin_pci_driver(ipc_driver)is used this just exposes the probe routine, which can occur at any point in time if this bus supports hotplug. A race can happen betweenkernel_init_freeable()that calls the init calls (in this case registeres theintel_scu_ipc.cdriver, and laterfree_initmem(), which would free thei2c_register_board_info(). If a probe happens later in booti2c_register_board_info()would not be present and we should get a page fault.
Quoted 1 line
Signed-off-by Luis R. Rodriguez <[email protected]>
Applied to for-current, thanks! Do you think this should go to stable?
Quoted 26 lines · Wolfram Sang
Quoted 25 lines · Luis R. Rodriguez
As of next-20160607 with allyesconfig we get this linker failure:
MODPOST vmlinux.o
WARNING:vmlinux.o(.text+0x21bc0d): Section mismatch in reference from the functionintel_scu_devices_create()to the function .init.text:i2c_register_board_info()This is caused by the fact that
intel_scu_devices_create()callsi2c_register_board_info()andintel_scu_devices_create()is not annotated with__init. This typically involves manual code inspection and if one is certain this is correct we would just pegintel_scu_devices_create()with a__refannotation.In this case this would be wrong though as the
intel_scu_devices_create()call is exported, and used in theipc_probe()ondrivers/platform/x86/intel_scu_ipc.c. The issue is that even thoughbuiltin_pci_driver(ipc_driver)is used this just exposes the probe routine, which can occur at any point in time if this bus supports hotplug. A race can happen betweenkernel_init_freeable()that calls the init calls (in this case registeres theintel_scu_ipc.cdriver, and laterfree_initmem(), which would free thei2c_register_board_info(). If a probe happens later in booti2c_register_board_info()would not be present and we should get a page fault.
Quoted 3 lines
Quoted 1 line
Signed-off-by Luis R. Rodriguez <[email protected]>Applied to for-current, thanks! Do you think this should go to stable?
Its a theoretical race, but a real one, but does fix allyesconfig builds. Up to you.
Luis