dmaengine/amba-pl08x: check slave_channels to avoid kernel panic
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
@@ -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
PATCH v2 1/1 dmaengine/amba-pl08x: check slave_channels to avoid kernel panic
Quoted 11 lines · Kassey Lee
commit
58baed44d52f5e0d87aca575318d71fe3937544cAuthor: Kassey Lee <[email protected]> Date: Wed Apr 11 02:22:26 2012 +0800dmaengine/amba-pl08x: check
slave_channelsto avoid kernel panic
slave_channelsis platform dependent, it should be initialized byboard.c, and here we need to check it to avoid a NULL panic.Signed-off-by Kassey,Lee <[email protected]>
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.