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

Commit 2e6758a1 authored by Prakash Gupta's avatar Prakash Gupta
Browse files

ion: fix hyp_assign_sg failure handling



In case of ion_hyp_assign_sg fails with partial buffers assigned to
destination vmid, we can't return back the buffer back to pool or buddy.
Let this leak to avoid fatal issue.

Change-Id: Ice499af55ecf781db7d066c8553e377507795177
Signed-off-by: default avatarPrakash Gupta <guptap@codeaurora.org>
parent 6cbd30c5
Loading
Loading
Loading
Loading
+10 −2
Original line number Original line Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-License-Identifier: GPL-2.0-only
/*
/*
 * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
 */
 */


#include <linux/slab.h>
#include <linux/slab.h>
@@ -114,7 +114,9 @@ static void process_one_prefetch(struct ion_heap *sys_heap,
		goto out;
		goto out;


	ret = ion_hyp_assign_sg(buffer.sg_table, &vmid, 1, true);
	ret = ion_hyp_assign_sg(buffer.sg_table, &vmid, 1, true);
	if (ret)
	if (ret == -EADDRNOTAVAIL)
		goto out1;
	else if (ret < 0)
		goto out;
		goto out;


	/* Now free it to the secure heap */
	/* Now free it to the secure heap */
@@ -123,6 +125,12 @@ static void process_one_prefetch(struct ion_heap *sys_heap,


out:
out:
	sys_heap->ops->free(&buffer);
	sys_heap->ops->free(&buffer);
out1:
	/*
	 * The security state of the pages is unknown after a failure;
	 * They can neither be added back to the secure pool nor buddy system.
	 */
	return;
}
}


/*
/*