android_kernel_oneplus_msm8998/drivers/i2c
Luis R. Rodriguez c4514d8b1b i2c: remove __init from i2c_register_board_info()
commit 5abe9b26847c65a698f38744a52635b287514294 upstream.

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.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
[wsa: made function declaration a one-liner]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-25 11:03:48 +01:00
..
algos i2c: algo-pca: fix typo in comment 2015-06-01 08:41:19 +09:00
busses i2c: riic: fix restart condition 2017-12-16 10:33:53 +01:00
muxes i2c: mux: fix up dependencies 2016-11-26 09:54:52 +01:00
i2c-boardinfo.c i2c: remove __init from i2c_register_board_info() 2018-02-25 11:03:48 +01:00
i2c-core.c i2c: print correct device invalid address 2017-01-19 20:17:20 +01:00
i2c-core.h i2c: remove FSF address 2014-11-07 18:35:33 +01:00
i2c-dev.c i2c: fix kernel memory disclosure in dev interface 2017-01-19 20:17:20 +01:00
i2c-mux.c i2c: add ACPI support for I2C mux ports 2015-10-25 15:49:46 +01:00
i2c-slave-eeprom.c i2c: Drop owner assignment from i2c_driver 2015-08-10 08:37:35 +02:00
i2c-smbus.c i2c: smbus: fix typo in commet 2015-06-01 08:41:26 +09:00
i2c-stub.c i2c: remove FSF address 2014-11-07 18:35:33 +01:00
Kconfig i2c: mux: fix up dependencies 2016-11-26 09:54:52 +01:00
Makefile i2c: slave-eeprom: add eeprom simulator driver 2014-12-11 22:25:54 +01:00