[lkml]   [2011]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH] uio/gen-pci: don't enable interrupts in ISR
    As reported by Anthony in a short way:

    |irq 17 handler uio_interrupt+0x0/0x68 enabled interrupts
    |NIP [c0069d84] handle_irq_event_percpu+0x260/0x26c

    The problem here is that spin_unlock_irq() enables the interrupts which
    is a no-no in interrupt context because they always run with interrupts
    disabled. This is the case even if IRQF_DISABLED has not been specified
    since v2.6.35. Therefore this patch uses simple spin_locks().

    Looking at it further here is only one spot where the lock is hold. So
    giving the fact that an ISR is not reentrant and is not executed on two
    cpus at the same time why do we need a lock here?
    The driver lacks of ->irqcontrol function so I guess the interrupt is
    enabled via direct PCI-access in userland. So there is _no_ protection
    against read-modify-write of user vs kernel so even that
    pci_block_user_cfg_access() is kinda pointless.
    pci_block_user_cfg_access() in open() + ->irqcontrol() should fix this.
    Since changes the API of this driver I leave it up to the relevant users
    what to do.

    Cc: <> # .35 and later
    Reported-and-Tested-by: Anthony Foiani <>
    Signed-off-by: Sebastian Andrzej Siewior <>
    drivers/uio/uio_pci_generic.c | 4 ++--
    1 files changed, 2 insertions(+), 2 deletions(-)

    diff --git a/drivers/uio/uio_pci_generic.c b/drivers/uio/uio_pci_generic.c
    index fc22e1e..5c82681 100644
    --- a/drivers/uio/uio_pci_generic.c
    +++ b/drivers/uio/uio_pci_generic.c
    @@ -57,7 +57,7 @@ static irqreturn_t irqhandler(int irq, struct uio_info *info)

    - spin_lock_irq(&gdev->lock);
    + spin_lock(&gdev->lock);

    /* Read both command and status registers in a single 32-bit operation.
    @@ -83,7 +83,7 @@ static irqreturn_t irqhandler(int irq, struct uio_info *info)

    - spin_unlock_irq(&gdev->lock);
    + spin_unlock(&gdev->lock);
    return ret;


     \ /
      Last update: 2011-08-04 22:49    [W:0.020 / U:55.220 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site