From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Sebastian Haas <dev@sebastianhaas.info>
Cc: Stephane Grosjean <s.grosjean@peak-system.com>,
Wolfgang Grandegger <wg@grandegger.com>,
linux-can Mailing List <linux-can@vger.kernel.org>
Subject: Re: can/sja1000: potential issue in sja1000.c?
Date: Fri, 10 Feb 2012 16:37:01 +0100 [thread overview]
Message-ID: <4F35399D.2010604@pengutronix.de> (raw)
In-Reply-To: <4F35388C.5040803@sebastianhaas.info>
[-- Attachment #1: Type: text/plain, Size: 1204 bytes --]
On 02/10/2012 04:32 PM, Sebastian Haas wrote:
>>> Is 0xff a valid value for REG_SR in the first place? If not we can for
>>> example exit the interrupt handler.
>>
>> Is the access to the address space of an unplugged card defined at all?
>> Or may it even hang the system?
> AFAIK PCMCIA is based on ISA and therefor it is absolutely valid to read
> and even write into this address space. It is up to user to check if the
> device is still there and accessiable.
>
> For that ems_pcmcia does something like this:
> static irqreturn_t ems_pcmcia_interrupt(int irq, void *dev_id)
> {
> ...
> /* Card not present */
> if (readw(card->base_addr) != 0xAA55)
> return IRQ_HANDLED;
>
> Call sja1000_interrupt() ...
> ...
> }
This code just makes the race window smaller, but you still have one.
It's a good idea to limit the number of rounds in the while loop in the
interrupt handler.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2012-02-10 15:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-03 15:12 [PATCH v2] can/sja1000: add support for PEAK-System PCMCIA card Stephane Grosjean
2012-02-03 16:44 ` Oliver Hartkopp
2012-02-06 16:03 ` Oliver Hartkopp
2012-02-06 17:05 ` Sven Geggus
2012-02-06 17:41 ` Oliver Hartkopp
[not found] ` <4F30F691.5070307@peak-system.com>
2012-02-07 13:13 ` About can/usb v4 patches serie Oliver Hartkopp
2012-02-07 13:43 ` Stephane Grosjean
2012-02-07 13:51 ` Oliver Hartkopp
2012-02-15 14:41 ` Stephane Grosjean
2012-02-15 20:05 ` Oliver Hartkopp
2012-02-10 11:00 ` can/sja1000: potential issue in sja1000.c? Stephane Grosjean
2012-02-10 11:16 ` Marc Kleine-Budde
2012-02-10 11:44 ` Wolfgang Grandegger
2012-02-10 15:32 ` Sebastian Haas
2012-02-10 15:37 ` Marc Kleine-Budde [this message]
2012-02-10 11:56 ` Wolfgang Grandegger
2012-02-10 15:39 ` Oliver Hartkopp
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=4F35399D.2010604@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=dev@sebastianhaas.info \
--cc=linux-can@vger.kernel.org \
--cc=s.grosjean@peak-system.com \
--cc=wg@grandegger.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).