[PATCH] ARM: 2694/1: [s3c2410/dma] release irq properly to fix kernel oops
authorAlbrecht Dreß <albrecht.dress@com.rmk.(none)>
Fri, 3 Jun 2005 19:52:26 +0000 (20:52 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 3 Jun 2005 19:52:26 +0000 (20:52 +0100)
Patch from Albrecht Dreß

Problem:
When a module requests a DMA channel via the function s3c2410_dma_request(), this function requests the appropriate irq under the name of the client module. When the client module is unloaded, it calls s3c2410_dma_free() which does not free the irq. Consequently, when e.g. running "cat /proc/interrupts", the irq owner points to freed memory, leading to a kernel oops.
File:
linux/arch/arm/mach-s3c2410/dma.c
Fix:
trivial, below

Signed-off-by: Albrecht Dreß
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-s3c2410/dma.c

index bc229fab86d44644fc4d3d5bc1793035f58ec4f9..c7c28890d406c25356b2643400360cb661ee1586 100644 (file)
@@ -785,6 +785,10 @@ int s3c2410_dma_free(dmach_t channel, s3c2410_dma_client_t *client)
        chan->client = NULL;
        chan->in_use = 0;
 
+       if (chan->irq_claimed)
+               free_irq(chan->irq, (void *)chan);
+       chan->irq_claimed = 0;
+
        local_irq_restore(flags);
 
        return 0;