mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 00:00:00 -04:00
msm: kgsl: Check user generated timestamp before queuing drawobjs
In ioctls like kgsl_ioctl_submit_commands(), if both syncobj type and cmd/marker/sparseobj type are submitted, the syncobj is queued first followed by the other obj type. After syncobj is successfully queued, in case of failure in get_timestamp while queuing the other obj, both the command objs are destroyed. As sync obj is already queued, accessing this later would cause a crash. Compare the user generated timestamp with the drawctxt timestamp and return early in case of error. This avoids unnecessary queuing of drawobjs. Change-Id: Iedebd480bc18cd74d2f69d24a9dc1032fab01cdb Signed-off-by: Kamal Agrawal <quic_kamaagra@quicinc.com>
This commit is contained in:
parent
f89c40b130
commit
046f27cfe2
1 changed files with 18 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "adreno.h"
|
||||
|
|
@ -902,6 +903,23 @@ int adreno_hwsched_queue_cmds(struct kgsl_device_private *dev_priv,
|
|||
|
||||
user_ts = *timestamp;
|
||||
|
||||
/*
|
||||
* If there is only one drawobj in the array and it is of
|
||||
* type SYNCOBJ_TYPE, skip comparing user_ts as it can be 0
|
||||
*/
|
||||
if (!(count == 1 && drawobj[0]->type == SYNCOBJ_TYPE) &&
|
||||
(drawctxt->base.flags & KGSL_CONTEXT_USER_GENERATED_TS)) {
|
||||
/*
|
||||
* User specified timestamps need to be greater than the last
|
||||
* issued timestamp in the context
|
||||
*/
|
||||
if (timestamp_cmp(drawctxt->timestamp, user_ts) >= 0) {
|
||||
spin_unlock(&drawctxt->lock);
|
||||
kmem_cache_free(jobs_cache, job);
|
||||
return -ERANGE;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
|
||||
switch (drawobj[i]->type) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue