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

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

Merge "msm: adsprpc: Put upper limit on IOMMU mapping size"

parents 8646f67d 62f7f9cb
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@
#define FASTRPC_STATIC_HANDLE_MAX (20)
#define FASTRPC_LATENCY_CTRL_ENB  (1)

#define MAX_SIZE_LIMIT (0x78000000)
#define INIT_FILELEN_MAX (2*1024*1024)
#define INIT_MEMLEN_MAX  (8*1024*1024)

@@ -951,6 +952,12 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd,
			map->size = buf_page_size(len);
		}

		VERIFY(err, map->size >= len && map->size < MAX_SIZE_LIMIT);
		if (err) {
			err = -EFAULT;
			goto bail;
		}

		vmid = fl->apps->channel[fl->cid].vmid;
		if (!sess->smmu.enabled && !vmid) {
			VERIFY(err, map->phys >= me->range.addr &&
@@ -994,9 +1001,11 @@ static int fastrpc_buf_alloc(struct fastrpc_file *fl, size_t size,
	struct fastrpc_buf *buf = NULL, *fr = NULL;
	struct hlist_node *n;

	VERIFY(err, size > 0);
	if (err)
	VERIFY(err, size > 0 && size < MAX_SIZE_LIMIT);
	if (err) {
		err = -EFAULT;
		goto bail;
	}

	if (!remote) {
		/* find the smallest buffer that fits in the cache */
@@ -4076,7 +4085,7 @@ static int fastrpc_cb_probe(struct device *dev)
		start = 0x60000000;
	VERIFY(err, !IS_ERR_OR_NULL(sess->smmu.mapping =
				arm_iommu_create_mapping(&platform_bus_type,
						start, 0x78000000)));
						start, MAX_SIZE_LIMIT)));
	if (err)
		goto bail;