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

Commit 57117681 authored by Susheel Khiani's avatar Susheel Khiani Committed by Liam Mark
Browse files

msm: secure_buffer: Fix possible NULL pointer dereference



Presently we were passing NULL dma_handle while
making dma_alloc_coherent call. This is an issue
as alloc function would try to populate handle
value with dma address and would end up getting
NULL pointer error. Fix this.

Change-Id: I38ebb9bbae2d6e1e1311fe438b3c8fc3f65e5692
Signed-off-by: default avatarSusheel Khiani <skhiani@codeaurora.org>
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent dd0da6e3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -403,12 +403,13 @@ bool msm_secure_v2_is_supported(void)
static int __init alloc_secure_shared_memory(void)
{
	int ret = 0;
	dma_addr_t dma_handle;

	qcom_secure_mem = kzalloc(QCOM_SECURE_MEM_SIZE, GFP_KERNEL);
	if (!qcom_secure_mem) {
		/* Fallback to CMA-DMA memory */
		qcom_secure_mem = dma_alloc_coherent(NULL, QCOM_SECURE_MEM_SIZE,
						NULL, GFP_KERNEL);
						&dma_handle, GFP_KERNEL);
		if (!qcom_secure_mem) {
			pr_err("Couldn't allocate memory for secure use-cases. hyp_assign_table will not work\n");
			return -ENOMEM;