All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Krafft <krafft@de.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: parabelboi@bopserverein.de, linuxppc-dev@ozlabs.org
Subject: Re: [Patch 2/2] powerpc: i2c-isa: add access check to legacy ioports
Date: Wed, 13 Feb 2008 18:37:01 +0100	[thread overview]
Message-ID: <20080213183701.254391cc@de.ibm.com> (raw)
In-Reply-To: <20080213182800.5c6940a8@de.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]

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
===================================================================
--- 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
 
 	dev_info(dev, "i/o base %#08lx. irq %d\n", base, irq);
 
+#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;


-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2008-02-13 17:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-13 17:28 [Patch 0/2] add check_legacy_ioport calls to prevent oops Christian Krafft
2008-02-13 17:28 ` Christian Krafft
2008-02-13 17:35 ` [Patch 0/2] powerpc: avoid userspace poking to legacy ioports Christian Krafft
2008-02-13 20:42   ` Benjamin Herrenschmidt
2008-02-13 20:42     ` Benjamin Herrenschmidt
2008-02-13 23:07     ` Arnd Bergmann
2008-02-13 23:07       ` Arnd Bergmann
2008-02-18 20:15     ` Jean Delvare
2008-02-18 20:15       ` Jean Delvare
2008-02-18 20:42       ` Benjamin Herrenschmidt
2008-02-18 20:42         ` Benjamin Herrenschmidt
2008-02-18 20:58         ` Jean Delvare
2008-02-18 20:58           ` Jean Delvare
2008-02-18 21:04           ` Arjan van de Ven
2008-02-18 21:04             ` Arjan van de Ven
2008-02-18 21:05           ` Benjamin Herrenschmidt
2008-02-18 21:05             ` Benjamin Herrenschmidt
2008-02-13 17:37 ` Christian Krafft [this message]
2008-02-18 13:31   ` [Patch 2/2] powerpc: i2c-isa: add access check " Jean Delvare
2008-02-18 13:31     ` Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080213183701.254391cc@de.ibm.com \
    --to=krafft@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=parabelboi@bopserverein.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.