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

Commit 6410dcb6 authored by Akhil P Oommen's avatar Akhil P Oommen
Browse files

msm: kgsl: Fix memory leak in _insert_gpuaddr()



There is a memory leak in _insert_gpuaddr() when a duplicate address
entry is found in the rb tree. Fix this by calling kmem_cache_free()
on the allocated memory.

Change-Id: Ia492d7cc523775bacc8a1fcfcd275fe922466e0b
Signed-off-by: default avatarAkhil P Oommen <akhilpo@codeaurora.org>
parent b232a372
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2011-2019, The Linux Foundation. All rights reserved.
 */
#include <linux/types.h>
#include <linux/delay.h>
@@ -2295,6 +2295,7 @@ static int _insert_gpuaddr(struct kgsl_pagetable *pagetable,
		else {
			/* Duplicate entry */
			WARN(1, "duplicate gpuaddr: 0x%llx\n", gpuaddr);
			kmem_cache_free(addr_entry_cache, new);
			return -EEXIST;
		}
	}