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

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

Merge "qseecom: check return value of __qseecom_process_reentrancy"

parents bedc71e4 dce7228d
Loading
Loading
Loading
Loading
+26 −14
Original line number Diff line number Diff line
@@ -3120,6 +3120,7 @@ static int __qseecom_send_cmd(struct qseecom_dev_handle *data,
				struct qseecom_send_cmd_req *req)
{
	int ret = 0;
	int ret2 = 0;
	u32 reqd_len_sb_in = 0;
	struct qseecom_client_send_data_ireq send_data_req = {0};
	struct qseecom_client_send_data_64bit_ireq send_data_req_64bit = {0};
@@ -3218,32 +3219,38 @@ static int __qseecom_send_cmd(struct qseecom_dev_handle *data,
	if (ret) {
		pr_err("scm_call() failed with err: %d (app_id = %d)\n",
					ret, data->client.app_id);
		return ret;
		goto exit;
	}

	if (qseecom.qsee_reentrancy_support) {
		ret = __qseecom_process_reentrancy(&resp, ptr_app, data);
		if (ret)
			goto exit;
	} else {
		if (resp.result == QSEOS_RESULT_INCOMPLETE) {
			ret = __qseecom_process_incomplete_cmd(data, &resp);
			if (ret) {
				pr_err("process_incomplete_cmd failed err: %d\n",
						ret);
				return ret;
				goto exit;
			}
		} else {
			if (resp.result != QSEOS_RESULT_SUCCESS) {
				pr_err("Response result %d not supported\n",
								resp.result);
				ret = -EINVAL;
				goto exit;
			}
		}
	}
	ret = msm_ion_do_cache_op(qseecom.ion_clnt, data->client.ihandle,
exit:
	ret2 = msm_ion_do_cache_op(qseecom.ion_clnt, data->client.ihandle,
				data->client.sb_virt, data->client.sb_length,
				ION_IOC_INV_CACHES);
	if (ret)
		pr_err("cache operation failed %d\n", ret);
	if (ret2) {
		pr_err("cache operation failed %d\n", ret2);
		return ret2;
	}
	return ret;
}

@@ -6564,6 +6571,7 @@ static int __qseecom_qteec_issue_cmd(struct qseecom_dev_handle *data,
	bool found_app = false;
	unsigned long flags;
	int ret = 0;
	int ret2 = 0;
	uint32_t reqd_len_sb_in = 0;
	void *cmd_buf = NULL;
	size_t cmd_len;
@@ -6673,43 +6681,47 @@ static int __qseecom_qteec_issue_cmd(struct qseecom_dev_handle *data,
	if (ret) {
		pr_err("scm_call() failed with err: %d (app_id = %d)\n",
					ret, data->client.app_id);
		return ret;
		goto exit;
	}

	if (qseecom.qsee_reentrancy_support) {
		ret = __qseecom_process_reentrancy(&resp, ptr_app, data);
		if (ret)
			goto exit;
	} else {
		if (resp.result == QSEOS_RESULT_INCOMPLETE) {
			ret = __qseecom_process_incomplete_cmd(data, &resp);
			if (ret) {
				pr_err("process_incomplete_cmd failed err: %d\n",
						ret);
				return ret;
				goto exit;
			}
		} else {
			if (resp.result != QSEOS_RESULT_SUCCESS) {
				pr_err("Response result %d not supported\n",
								resp.result);
				ret = -EINVAL;
				goto exit;
			}
		}
	}
	ret = msm_ion_do_cache_op(qseecom.ion_clnt, data->client.ihandle,
exit:
	ret2 = msm_ion_do_cache_op(qseecom.ion_clnt, data->client.ihandle,
				data->client.sb_virt, data->client.sb_length,
				ION_IOC_INV_CACHES);
	if (ret) {
	if (ret2) {
		pr_err("cache operation failed %d\n", ret);
		return ret;
		return ret2;
	}

	if ((cmd_id == QSEOS_TEE_OPEN_SESSION) ||
			(cmd_id == QSEOS_TEE_REQUEST_CANCELLATION)) {
		ret = __qseecom_update_qteec_req_buf(
		ret2 = __qseecom_update_qteec_req_buf(
			(struct qseecom_qteec_modfd_req *)req, data, true);
		if (ret)
			return ret;
		if (ret2)
			return ret2;
	}
	return 0;
	return ret;
}

static int qseecom_qteec_open_session(struct qseecom_dev_handle *data,