Skip to content

Commit

Permalink
DMA: PL330: Fix potential NULL pointer dereference in pl330_submit_req()
Browse files Browse the repository at this point in the history
'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>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
  • Loading branch information
Sachin Kamat authored and Vinod Koul committed Sep 18, 2012
1 parent c456797 commit 2e2c682
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions drivers/dma/pl330.c
Original file line number Diff line number Diff line change
Expand Up @@ -1567,17 +1567,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)) {
Expand Down

0 comments on commit 2e2c682

Please sign in to comment.