Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: tglx@linutronix.de (Thomas Gleixner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 1/2] PRUSS UIO driver support
Date: Fri, 25 Feb 2011 10:54:28 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.00.1102251049090.2701@localhost6.localdomain6> (raw)
In-Reply-To: <1298623530-10294-2-git-send-email-pratheesh@ti.com>

On Fri, 25 Feb 2011, Pratheesh Gangadhar wrote:
> +static irqreturn_t pruss_handler(int irq, struct uio_info *dev_info)
> +{
> +	void __iomem *base = dev_info->mem[0].internal_addr;
> +	void __iomem *intren_reg = base + PINTC_HIER;
> +	void __iomem *intrstat_reg = base + PINTC_HIPIR + ((irq - 1) << 2);
> +	int val = ioread32(intren_reg), intr_mask = (1 << (irq - 1));
> +
> +	/* Is interrupt enabled and active ? */
> +	if (!(val & intr_mask) && (ioread32(intrstat_reg) & HIPIR_NOPEND))
> +		return IRQ_NONE;
> +
> +	/* Disable interrupt */
> +	iowrite32((val & ~intr_mask), intren_reg);
> +	return IRQ_HANDLED;
> +}

Hmm, just noticed, that you fiddle with the interrupt enable register
here totally unprotected. So on a SMP system you might haandle two
different interrupts at the same time. That wants locking.

And even on UP, you have a problem as you reenable that thing from
user space which requires a read modify write. Racy as hell.

Please look at the other UIO drivers which have the same problem.
Sorry for not noticing earlier!

Thanks,

	tglx

  parent reply	other threads:[~2011-02-25  9:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-25  8:45 [PATCH v5 0/2] Add PRUSS UIO driver support Pratheesh Gangadhar
2011-02-25  8:45 ` [PATCH v5 1/2] " Pratheesh Gangadhar
2011-02-25  8:45   ` [PATCH v5 2/2] Defines DA850/AM18xx/OMAPL1-38 SOC resources used by PRUSS UIO driver Pratheesh Gangadhar
2011-02-25  9:54   ` Thomas Gleixner [this message]
2011-02-28  4:02     ` [PATCH v5 1/2] PRUSS UIO driver support TK, Pratheesh Gangadhar

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=alpine.LFD.2.00.1102251049090.2701@localhost6.localdomain6 \
    --to=tglx@linutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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