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

Commit 6bda31db authored by Krishnankutty Kolathappilly's avatar Krishnankutty Kolathappilly
Browse files

msm: cpp: Return appropriate error on checking physical address



Negative value is returned from msm_cpp_queue_buffer_info. The return
value expects physical address. This results in invalid value to be
returned as physical address during error scenarios causing iommu
page fault. Return zero value for address on any errors.

CRs-Fixed: 928920
Change-Id: Idbf634db3e737e55b07ab8b2805dc7de1d534c26
Signed-off-by: default avatarKrishnankutty Kolathappilly <kkolatha@codeaurora.org>
parent 6cb8923f
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -447,7 +447,7 @@ static unsigned long msm_cpp_queue_buffer_info(struct cpp_device *cpp_dev,
	list_for_each_entry_safe(buff, save, buff_head, entry) {
	list_for_each_entry_safe(buff, save, buff_head, entry) {
		if (buff->map_info.buff_info.index == buffer_info->index) {
		if (buff->map_info.buff_info.index == buffer_info->index) {
			pr_err("error buffer index already queued\n");
			pr_err("error buffer index already queued\n");
			return -EINVAL;
			goto error;
		}
		}
	}
	}


@@ -455,7 +455,7 @@ static unsigned long msm_cpp_queue_buffer_info(struct cpp_device *cpp_dev,
		sizeof(struct msm_cpp_buffer_map_list_t), GFP_KERNEL);
		sizeof(struct msm_cpp_buffer_map_list_t), GFP_KERNEL);
	if (!buff) {
	if (!buff) {
		pr_err("error allocating memory\n");
		pr_err("error allocating memory\n");
		return -EINVAL;
		goto error;
	}
	}
	buff->map_info.buff_info = *buffer_info;
	buff->map_info.buff_info = *buffer_info;


@@ -466,13 +466,15 @@ static unsigned long msm_cpp_queue_buffer_info(struct cpp_device *cpp_dev,
	if (rc < 0) {
	if (rc < 0) {
		pr_err("ION mmap failed\n");
		pr_err("ION mmap failed\n");
		kzfree(buff);
		kzfree(buff);
		return rc;
		goto error;
	}
	}


	INIT_LIST_HEAD(&buff->entry);
	INIT_LIST_HEAD(&buff->entry);
	list_add_tail(&buff->entry, buff_head);
	list_add_tail(&buff->entry, buff_head);


	return buff->map_info.phy_addr;
	return buff->map_info.phy_addr;
error:
	return 0;
}
}


static void msm_cpp_dequeue_buffer_info(struct cpp_device *cpp_dev,
static void msm_cpp_dequeue_buffer_info(struct cpp_device *cpp_dev,