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

Commit 1babb91a authored by Gopireddy Arunteja Reddy's avatar Gopireddy Arunteja Reddy Committed by Marco Zhang
Browse files

msm: eva: User after free fix in msm_cvp_mark_user_persist



Update buffer ktid inside mutex protetion.

Change-Id: I86767eb60e1f78e373233c0f64c3b5a2249cba0e
Signed-off-by: default avatarGopireddy Arunteja Reddy <quic_garuntej@quicinc.com>
parent 920dbdcf
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include "msm_cvp_common.h"
@@ -643,9 +644,10 @@ int msm_cvp_mark_user_persist(struct msm_cvp_inst *inst,
		list_for_each_entry_safe(pbuf, dummy, &inst->persistbufs.list,
				list) {
			if (pbuf->ownership == CLIENT) {
				if (pbuf->fd == buf->fd &&
					pbuf->size == buf->size)
				if (pbuf->fd == buf->fd && pbuf->size == buf->size) {
					buf->fd = pbuf->smem->device_addr;
					pbuf->ktid = ktid;
				}
				rc = 1;
				break;
			}
@@ -657,7 +659,6 @@ int msm_cvp_mark_user_persist(struct msm_cvp_inst *inst,
			rc = -EFAULT;
			break;
		}
		pbuf->ktid = ktid;
		rc = 0;
	}
	return rc;