Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e2c682b authored by Sachin Kamat's avatar Sachin Kamat Committed by Vinod Koul
Browse files

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: default avatarSachin Kamat <sachin.kamat@linaro.org>
Acked-by: default avatarJassi Brar <jassisinghbrar@gmail.com>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: default avatarVinod Koul <vinod.koul@linux.intel.com>
parent c4567976
Loading
Loading
Loading
Loading
+9 −7
Original line number Original line Diff line number Diff line
@@ -1567,17 +1567,19 @@ static int pl330_submit_req(void *ch_id, struct pl330_req *r)
		goto xfer_exit;
		goto xfer_exit;
	}
	}



	/* Use last settings, if not provided */
	if (r->cfg) {
		/* Prefer Secure Channel */
		/* Prefer Secure Channel */
		if (!_manager_ns(thrd))
		if (!_manager_ns(thrd))
			r->cfg->nonsecure = 0;
			r->cfg->nonsecure = 0;
		else
		else
			r->cfg->nonsecure = 1;
			r->cfg->nonsecure = 1;


	/* Use last settings, if not provided */
	if (r->cfg)
		ccr = _prepare_ccr(r->cfg);
		ccr = _prepare_ccr(r->cfg);
	else
	} else {
		ccr = readl(regs + CC(thrd->id));
		ccr = readl(regs + CC(thrd->id));
	}


	/* If this req doesn't have valid xfer settings */
	/* If this req doesn't have valid xfer settings */
	if (!_is_valid(ccr)) {
	if (!_is_valid(ccr)) {