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

Commit 9c5d12b0 authored by Michael Adisumarta's avatar Michael Adisumarta
Browse files

msm: ipa: Early assert for invalid event ring Read Pointer



This fix asserts early in the event of event ring Read Pointer
not being in the range of ring's base and end address.

Change-Id: Ief60e199ac783be3192b7719c52029c60f068dbf
Acked-by: default avatarJyothi Jayanthi <jyothij@qti.qualcomm.com>
Signed-off-by: default avatarMichael Adisumarta <madisuma@codeaurora.org>
parent 084dd0e5
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -379,12 +379,18 @@ static uint16_t gsi_get_complete_num(struct gsi_ring_ctx *ctx, uint64_t addr1,
{
	uint32_t addr_diff;

	WARN(addr1 < ctx->base || addr1 >= ctx->end,
		"address not in range. base 0x%llx end 0x%llx addr 0x%llx\n",
		ctx->base, ctx->end, addr1);
	WARN(addr2 < ctx->base || addr2 >= ctx->end,
		"address not in range. base 0x%llx end 0x%llx addr 0x%llx\n",
		ctx->base, ctx->end, addr2);
	GSIDBG_LOW("gsi base addr 0x%llx end addr 0x%llx\n",
		ctx->base, ctx->end);

	if (addr1 < ctx->base || addr1 >= ctx->end) {
		GSIERR("address = 0x%llx not in range\n", addr1);
		BUG();
	}

	if (addr2 < ctx->base || addr2 >= ctx->end) {
		GSIERR("address = 0x%llx not in range\n", addr2);
		BUG();
	}

	addr_diff = (uint32_t)(addr2 - addr1);
	if (addr1 < addr2)