summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFranck Jullien <franck.jullien@odyssee-systemes.fr>2016-03-22 11:52:22 +0100
committerVinod Koul <vinod.koul@intel.com>2016-04-05 11:10:57 -0700
commit330ed4da2c8eb821e70b1366a7af53eb1c7421fb (patch)
treec513381a2a3214cf06fa1b8a9ec9358aab49e4b5
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff)
downloadlinux-330ed4da2c8eb821e70b1366a7af53eb1c7421fb.tar.gz
linux-330ed4da2c8eb821e70b1366a7af53eb1c7421fb.tar.bz2
linux-330ed4da2c8eb821e70b1366a7af53eb1c7421fb.zip
dmaengine: vdma: don't crash when bad channel is requested
When client request a non existing channel from of_dma_xilinx_xlate we get a NULL pointer dereferencing. This patch fix this problem. Signed-off-by: Franck Jullien <franck.jullien@odyssee-systemes.fr> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r--drivers/dma/xilinx/xilinx_vdma.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/dma/xilinx/xilinx_vdma.c b/drivers/dma/xilinx/xilinx_vdma.c
index 0ee0321868d3..ef67f278e076 100644
--- a/drivers/dma/xilinx/xilinx_vdma.c
+++ b/drivers/dma/xilinx/xilinx_vdma.c
@@ -1236,7 +1236,7 @@ static struct dma_chan *of_dma_xilinx_xlate(struct of_phandle_args *dma_spec,
struct xilinx_vdma_device *xdev = ofdma->of_dma_data;
int chan_id = dma_spec->args[0];
- if (chan_id >= XILINX_VDMA_MAX_CHANS_PER_DEVICE)
+ if (chan_id >= XILINX_VDMA_MAX_CHANS_PER_DEVICE || !xdev->chan[chan_id])
return NULL;
return dma_get_slave_channel(&xdev->chan[chan_id]->common);