Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

i2c-pca-isa: Add access check to legacy ioports

When probing i2c-pca-isa writes to legacy ioports, which crashes the kernel
if there is no device at that port.
This patch adds a check_legacy_ioport call, so probe fails gracefully
and thus prevents the oops.

Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>

authored by

Christian Krafft and committed by
Jean Delvare
104cb574 9e39ffef

+7
+7
drivers/i2c/busses/i2c-pca-isa.c
··· 125 125 126 126 dev_info(dev, "i/o base %#08lx. irq %d\n", base, irq); 127 127 128 + #ifdef CONFIG_PPC_MERGE 129 + if (check_legacy_ioport(base)) { 130 + dev_err(dev, "I/O address %#08lx is not available\n", base); 131 + goto out; 132 + } 133 + #endif 134 + 128 135 if (!request_region(base, IO_SIZE, "i2c-pca-isa")) { 129 136 dev_err(dev, "I/O address %#08lx is in use\n", base); 130 137 goto out;