linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] dmaengine/amba-pl08x: check slave_channels to avoid kernel panic
@ 2012-05-15 10:19 Kassey Lee
  2012-05-15 10:22 ` Russell King - ARM Linux
  0 siblings, 1 reply; 2+ messages in thread
From: Kassey Lee @ 2012-05-15 10:19 UTC (permalink / raw)
  To: linux-arm-kernel

commit 58baed44d52f5e0d87aca575318d71fe3937544c
Author: Kassey Lee <kassey1216@gmail.com>
Date:   Wed Apr 11 02:22:26 2012 +0800

    dmaengine/amba-pl08x: check slave_channels to avoid kernel panic

    slave_channels is platform dependent, it should
    be initialized by board.c, and here we need to check it
    to avoid a NULL panic.

    Signed-off-by: Kassey,Lee <kassey1216@gmail.com>

diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 3d704ab..350e1fa 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -1688,6 +1688,12 @@ static int
pl08x_dma_init_virtual_channels(struct pl08x_driver_data *pl08x,
                chan->state = PL08X_CHAN_IDLE;

                if (slave) {
+                       if (!pl08x->pd->slave_channels) {
+                               dev_err(&pl08x->adev->dev,
+                                       "%s slave_channels is not
initialized\n", __func__);
+                               kfree(chan);
+                               return -EINVAL;
+                       }
                        chan->cd = &pl08x->pd->slave_channels[i];
                        pl08x_dma_slave_init(chan);
                } else {


-- 
Best regards
Kassey

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

* [PATCH V2] dmaengine/amba-pl08x: check slave_channels to avoid kernel panic
  2012-05-15 10:19 [PATCH V2] dmaengine/amba-pl08x: check slave_channels to avoid kernel panic Kassey Lee
@ 2012-05-15 10:22 ` Russell King - ARM Linux
  0 siblings, 0 replies; 2+ messages in thread
From: Russell King - ARM Linux @ 2012-05-15 10:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 15, 2012 at 06:19:36PM +0800, Kassey Lee wrote:
> commit 58baed44d52f5e0d87aca575318d71fe3937544c
> Author: Kassey Lee <kassey1216@gmail.com>
> Date:   Wed Apr 11 02:22:26 2012 +0800
> 
>     dmaengine/amba-pl08x: check slave_channels to avoid kernel panic
> 
>     slave_channels is platform dependent, it should
>     be initialized by board.c, and here we need to check it
>     to avoid a NULL panic.
> 
>     Signed-off-by: Kassey,Lee <kassey1216@gmail.com>

Why would you set pd->num_slave_channels nonzero but leave
pd->slave_channels as a NULL pointer?

That sounds like a configuration error to me.

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

end of thread, other threads:[~2012-05-15 10:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-15 10:19 [PATCH V2] dmaengine/amba-pl08x: check slave_channels to avoid kernel panic Kassey Lee
2012-05-15 10:22 ` Russell King - ARM Linux

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).