Re: [Patch 2/2] powerpc: i2c-isa: add access check to legacy ioports

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Christian Krafft
Date: Wednesday, February 13, 2008 - 10:37 am

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 failes gracefully
and thus prevents the oops.

Signed-off-by: Christian Krafft <krafft@de.ibm.com>

Index: linux.git/drivers/i2c/busses/i2c-pca-isa.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux.git.orig/drivers/i2c/busses/i2c-pca-isa.c
+++ linux.git/drivers/i2c/busses/i2c-pca-isa.c
@@ -125,6 +125,13 @@ static int __devinit pca_isa_probe(struc
=20
 	dev_info(dev, "i/o base %#08lx. irq %d\n", base, irq);
=20
+#ifdef CONFIG_PPC_MERGE
+	if (check_legacy_ioport(base)) {
+		dev_err(dev, "I/O address %#08lx is not available\n", base);
+		goto out;
+	}
+#endif
+
 	if (!request_region(base, IO_SIZE, "i2c-pca-isa")) {
 		dev_err(dev, "I/O address %#08lx is in use\n", base);
 		goto out;


--=20
Mit freundlichen Gruessen,
kind regards,

Christian Krafft
IBM Systems & Technology Group,
Linux Kernel Development
IT Specialist


Vorsitzender des Aufsichtsrats:	Martin Jetter
Geschaeftsfuehrung:		Herbert Kircher
Sitz der Gesellschaft:		Boeblingen
Registriergericht:		Amtsgericht Stuttgart, HRB 243294
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[Patch 0/2] add check_legacy_ioport calls to prevent oops, Christian Krafft, (Wed Feb 13, 10:28 am)
Re: [Patch 0/2] powerpc: avoid userspace poking to legacy ..., Christian Krafft, (Wed Feb 13, 10:35 am)
Re: [Patch 2/2] powerpc: i2c-isa: add access check to lega ..., Christian Krafft, (Wed Feb 13, 10:37 am)
Re: [Patch 0/2] powerpc: avoid userspace poking to legacy ..., Benjamin Herrenschmidt, (Wed Feb 13, 1:42 pm)
Re: [Patch 0/2] powerpc: avoid userspace poking to legacy ..., Benjamin Herrenschmidt, (Mon Feb 18, 1:42 pm)
Re: [Patch 0/2] powerpc: avoid userspace poking to legacy ..., Arjan van de Ven, (Mon Feb 18, 2:04 pm)
Re: [Patch 0/2] powerpc: avoid userspace poking to legacy ..., Benjamin Herrenschmidt, (Mon Feb 18, 2:05 pm)