Merge "msm: eva: User after free fix in msm_cvp_mark_user_persist"

This commit is contained in:
qctecmdr 2024-03-12 04:26:12 -07:00 • committed by Gerrit - the friendly Code Review server
commit edd54a3236

View file

@ -1,6 +1,7 @@
// 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;