Skip to content

Commit 104cb57

Browse files
Christian KrafftJean Delvare
authored andcommitted
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>
1 parent 9e39ffe commit 104cb57

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎drivers/i2c/busses/i2c-pca-isa.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ static int __devinit pca_isa_probe(struct device *dev, unsigned int id)
125125

126126
dev_info(dev, "i/o base %#08lx. irq %d\n", base, irq);
127127

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+
128135
if (!request_region(base, IO_SIZE, "i2c-pca-isa")) {
129136
dev_err(dev, "I/O address %#08lx is in use\n", base);
130137
goto out;

0 commit comments

Comments
 (0)