Skip to contentSkip to conversation

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

PATCH New Kassey Lee 2 participants 2 messages May 15, 2012 dmaengine

lore
Share & tools
lore

Kassey Lee

author
#0 lore raw

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

commit 58baed44d52f5e0d87aca575318d71fe3937544c

Author: Kassey Lee <[email protected]>
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.

drivers/dma/amba-pl08x.c +0 -0
index 3d704ab..350e1fa 100644
@@ -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 {
Signature · 2 lines
Best regards
Kassey
#1 lore raw

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

Quoted 11 lines · Kassey Lee

commit 58baed44d52f5e0d87aca575318d71fe3937544c

Author: Kassey Lee <[email protected]>
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.

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.