summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-09-17 15:20:22 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-02 10:30:10 -0700
commitfe9803b58dce15848465ab0270ccea29f4a5c4bb (patch)
tree0001d3c0b64a1eea939967e6fa99c0ddf575e446 /drivers/dma
parent7334e402a35e0379933e8b0442f0baeed1104217 (diff)
DMA: PL330: Fix potential NULL pointer dereference in pl330_submit_req()
commit 2e2c682becb20416c140aa0d6d3137b51a5c76da upstream. 'r->cfg' is being checked for NULL. However, it is dereferenced in the previous statements. Thus moving those statements within the check. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Jassi Brar <jassisinghbrar@gmail.com> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/pl330.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 8c44f17a99e4..69f1c4dc4b87 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -1568,17 +1568,19 @@ static int pl330_submit_req(void *ch_id, struct pl330_req *r)
goto xfer_exit;
}
- /* Prefer Secure Channel */
- if (!_manager_ns(thrd))
- r->cfg->nonsecure = 0;
- else
- r->cfg->nonsecure = 1;
/* Use last settings, if not provided */
- if (r->cfg)
+ if (r->cfg) {
+ /* Prefer Secure Channel */
+ if (!_manager_ns(thrd))
+ r->cfg->nonsecure = 0;
+ else
+ r->cfg->nonsecure = 1;
+
ccr = _prepare_ccr(r->cfg);
- else
+ } else {
ccr = readl(regs + CC(thrd->id));
+ }
/* If this req doesn't have valid xfer settings */
if (!_is_valid(ccr)) {