]> git.baikalelectronics.ru Git - kernel.git/commit
i2c: acpi: Fix NULL Pointer dereference
authorPeter Hüwe <PeterHuewe@gmx.de>
Fri, 12 Sep 2014 19:09:47 +0000 (21:09 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Thu, 25 Sep 2014 14:08:15 +0000 (16:08 +0200)
commitd5157ae2d4abc19fc0401021f135da17ad119014
treec50a07ae7431e7cc42117f34afc070fb195dc488
parent102d1c2eaad84134cddce8c5600d397d61fa63dd
i2c: acpi: Fix NULL Pointer dereference

If adapter->dev.parent == NULL there is a NULL pointer dereference in
acpi_i2c_install_space_handler and acpi_i2c_remove_space_handler.

This is present since introduction of this code:
a680da8461b7 "i2c: rework kernel config I2C_ACPI" or even
d1709bae59e0 "I2C/ACPI: Clean up I2C ACPI code and Add CONFIG_I2C_ACPI"

The adapter->dev.parent == NULL case is valid for the i2c_stub,
so loading i2c_stub with ACPI_I2C_OPREGION enabled results in an oops.
This is also valid at least for i2c_tiny_usb and i2c_robotfuzz_osif.

Fix by checking whether it is null before calling ACPI_HANDLE.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/i2c-core.c