All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dma: mmp-pdma: fix irq handler overwrite physical chan issue
@ 2015-02-04  6:16 Qiao Zhou
  2015-02-06  5:27 ` Zhangfei Gao
  2015-02-23 11:23 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Qiao Zhou @ 2015-02-04  6:16 UTC (permalink / raw)
  To: dan.j.williams, vinod.koul, dmaengine, linux-kernel, zhangfei.gao
  Cc: Qiao Zhou

Some dma channels may be reserved for other purpose in other layer,
like secure driver in EL2/EL3. PDMA driver can see the interrupt
status, but it should not try to handle related interrupt, since it
doesn't belong to PDMA driver in kernel. These interrupts should be
handled by corresponding client/module.Otherwise, it will overwrite
illegal memory and cause unexpected issues, since pdma driver only
requests resources for pdma channels.

In PDMA driver, the reserved channels are at the end of total 32
channels. If we find interrupt bit index is not smaller than total
dma channels, we should ignore it.

Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
---
 drivers/dma/mmp_pdma.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index 8b8952f..68ab55f 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -219,6 +219,9 @@ static irqreturn_t mmp_pdma_int_handler(int irq, void *dev_id)
 
 	while (dint) {
 		i = __ffs(dint);
+		/* only handle interrupts belonging to pdma driver*/
+		if (i >= pdev->dma_channels)
+			break;
 		dint &= (dint - 1);
 		phy = &pdev->phy[i];
 		ret = mmp_pdma_chan_handler(irq, phy);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dma: mmp-pdma: fix irq handler overwrite physical chan issue
  2015-02-04  6:16 [PATCH] dma: mmp-pdma: fix irq handler overwrite physical chan issue Qiao Zhou
@ 2015-02-06  5:27 ` Zhangfei Gao
  2015-02-23 11:23 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Zhangfei Gao @ 2015-02-06  5:27 UTC (permalink / raw)
  To: Qiao Zhou; +Cc: Williams, Dan J, Vinod Koul, dmaengine, LKML

On 4 February 2015 at 14:16, Qiao Zhou <zhouqiao@marvell.com> wrote:
> Some dma channels may be reserved for other purpose in other layer,
> like secure driver in EL2/EL3. PDMA driver can see the interrupt
> status, but it should not try to handle related interrupt, since it
> doesn't belong to PDMA driver in kernel. These interrupts should be
> handled by corresponding client/module.Otherwise, it will overwrite
> illegal memory and cause unexpected issues, since pdma driver only
> requests resources for pdma channels.
>
> In PDMA driver, the reserved channels are at the end of total 32
> channels. If we find interrupt bit index is not smaller than total
> dma channels, we should ignore it.
>
> Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>

Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>

Thanks for the patch.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dma: mmp-pdma: fix irq handler overwrite physical chan issue
  2015-02-04  6:16 [PATCH] dma: mmp-pdma: fix irq handler overwrite physical chan issue Qiao Zhou
  2015-02-06  5:27 ` Zhangfei Gao
@ 2015-02-23 11:23 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2015-02-23 11:23 UTC (permalink / raw)
  To: Qiao Zhou; +Cc: dan.j.williams, dmaengine, linux-kernel, zhangfei.gao

On Wed, Feb 04, 2015 at 02:16:03PM +0800, Qiao Zhou wrote:
> Some dma channels may be reserved for other purpose in other layer,
> like secure driver in EL2/EL3. PDMA driver can see the interrupt
> status, but it should not try to handle related interrupt, since it
> doesn't belong to PDMA driver in kernel. These interrupts should be
> handled by corresponding client/module.Otherwise, it will overwrite
> illegal memory and cause unexpected issues, since pdma driver only
> requests resources for pdma channels.
> 
> In PDMA driver, the reserved channels are at the end of total 32
> channels. If we find interrupt bit index is not smaller than total
> dma channels, we should ignore it.
Applied, now

Thanks

-- 
~Vinod


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-23 11:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-04  6:16 [PATCH] dma: mmp-pdma: fix irq handler overwrite physical chan issue Qiao Zhou
2015-02-06  5:27 ` Zhangfei Gao
2015-02-23 11:23 ` Vinod Koul

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.