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

Commit 8fd74cd8 authored by Archana Sriram's avatar Archana Sriram
Browse files

msm: kgsl: Check snapshot objs size before saving to memory



Before saving the snapshot frozen objects into memory, check
if they fit into snapshot memory size allocated to prevent
out of bound write.

Change-Id: I3f3d3de019eb2b64050b8691af1220f0185aa984
Signed-off-by: default avatarArchana Sriram <apsrir@codeaurora.org>
parent 2e88452c
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1296,6 +1296,11 @@ static void kgsl_snapshot_save_frozen_objs(struct work_struct *work)
	if (size == 0)
		goto done;

	if (size > device->snapshot_memory.size) {
		SNAPSHOT_ERR_NOMEM(device, "OBJS");
		goto done;
	}

	snapshot->mempool = vmalloc(size);

	ptr = snapshot->mempool;