diff options
| author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-09-17 05:50:22 -0400 |
|---|---|---|
| committer | Vinod Koul <vinod.koul@linux.intel.com> | 2012-09-17 23:34:52 -0400 |
| commit | 2e2c682becb20416c140aa0d6d3137b51a5c76da (patch) | |
| tree | 460b626180e90deb7368f60a823345a63228f26b /drivers | |
| parent | c456797681db814f4f5b36909e8e94047bf53d9c (diff) | |
DMA: PL330: Fix potential NULL pointer dereference in pl330_submit_req()
'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>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/dma/pl330.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index e4feba6b03c0..a3b26ada8122 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
| @@ -1567,17 +1567,19 @@ static int pl330_submit_req(void *ch_id, struct pl330_req *r) | |||
| 1567 | goto xfer_exit; | 1567 | goto xfer_exit; |
| 1568 | } | 1568 | } |
| 1569 | 1569 | ||
| 1570 | /* Prefer Secure Channel */ | ||
| 1571 | if (!_manager_ns(thrd)) | ||
| 1572 | r->cfg->nonsecure = 0; | ||
| 1573 | else | ||
| 1574 | r->cfg->nonsecure = 1; | ||
| 1575 | 1570 | ||
| 1576 | /* Use last settings, if not provided */ | 1571 | /* Use last settings, if not provided */ |
| 1577 | if (r->cfg) | 1572 | if (r->cfg) { |
| 1573 | /* Prefer Secure Channel */ | ||
| 1574 | if (!_manager_ns(thrd)) | ||
| 1575 | r->cfg->nonsecure = 0; | ||
| 1576 | else | ||
| 1577 | r->cfg->nonsecure = 1; | ||
| 1578 | |||
| 1578 | ccr = _prepare_ccr(r->cfg); | 1579 | ccr = _prepare_ccr(r->cfg); |
| 1579 | else | 1580 | } else { |
| 1580 | ccr = readl(regs + CC(thrd->id)); | 1581 | ccr = readl(regs + CC(thrd->id)); |
| 1582 | } | ||
| 1581 | 1583 | ||
| 1582 | /* If this req doesn't have valid xfer settings */ | 1584 | /* If this req doesn't have valid xfer settings */ |
| 1583 | if (!_is_valid(ccr)) { | 1585 | if (!_is_valid(ccr)) { |
