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

Commit 54cc4353 authored by Harsh Vardhan Dwivedi's avatar Harsh Vardhan Dwivedi
Browse files

msm: kgsl: Reject free waittimestamp calls on incorrect parameters



Reject free waittimestamp calls when user supplies incorrect
type for timestamp.

Change-Id: Ib6c9a348e5de1d80617d336391e721f72523e51e
Signed-off-by: default avatarHarsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
parent 156b58aa
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -2196,6 +2196,19 @@ static void kgsl_freemem_event_cb(struct kgsl_device *device,
	kgsl_mem_entry_put(entry);
}

/**
 * _cmdstream_freememontimestamp(): Implements core mechanism for freeing
 * memory on timestamp.
 * @dev_priv: Pointer to device private GPU struct
 * @gpuaddr: gpuaddr (memory entry) to be freed
 * @timestamp: Timestamp to be freed on
 * @type: Type of timestamp
 *
 * Implements the core mechanism of freeing a given GPU memory entry (identified
 * by gpuaddr) when the supplied timestamp becomes RETIRED timestamp for
 * the given context. This is done by adding this timestamp expiration as an
 * event to be acted on, on the timeline for this context.
 */
static long _cmdstream_freememontimestamp(struct kgsl_device_private *dev_priv,
		unsigned int gpuaddr, struct kgsl_context *context,
		unsigned int timestamp, unsigned int type)
@@ -2206,6 +2219,11 @@ static long _cmdstream_freememontimestamp(struct kgsl_device_private *dev_priv,
	unsigned int temp_cur_ts = 0;
	struct kgsl_device *device = dev_priv->device;

	/*
	 * If the user supplies incorrect type for timestamp, bail.
	 */
	if (type != KGSL_TIMESTAMP_RETIRED)
		return -EINVAL;
	entry = kgsl_sharedmem_find(dev_priv->process_priv, gpuaddr);

	if (!entry) {