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

Commit 4fa6254f authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

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

parents ca7e878f 41c380b9
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -104,6 +104,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)
#define MAX_CACHE_BUF_SIZE (8*1024*1024)
@@ -924,6 +925,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 &&
@@ -968,9 +975,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 */
@@ -3857,7 +3866,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) {
		pr_err("adsprpc: %s: creating iommu mapping failed for %s, ret %pK",
				__func__, dev_name(dev), sess->smmu.mapping);