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

Commit 671313df authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Reject free waittimestamp calls on incorrect parameters"

parents bf850d5a 54cc4353
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -2197,6 +2197,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)
@@ -2207,6 +2220,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) {