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

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

Merge "qseecom: allocate sglistinfo buffer for kernel clients"

parents 8520282a b54cce80
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -3324,6 +3324,7 @@ static int __qseecom_update_cmd_buf_64(void *msg, bool cleanup,
				}
			}
			len = QSEECOM_SG_LIST_BUF_HDR_SZ_64BIT;
			sg = sg_ptr->sgl;
			goto cleanup;
		}
		sg = sg_ptr->sgl;
@@ -4090,12 +4091,21 @@ int qseecom_start_app(struct qseecom_handle **handle,
	data->client.user_virt_sb_base = 0;
	data->client.ihandle = NULL;

	/* Allocate sglistinfo buffer for kernel client */
	data->sglistinfo_ptr = kzalloc(SGLISTINFO_TABLE_SIZE, GFP_KERNEL);
	if (!(data->sglistinfo_ptr)) {
		kfree(data);
		kfree(*handle);
		*handle = NULL;
		return -ENOMEM;
	}
	init_waitqueue_head(&data->abort_wq);

	data->client.ihandle = ion_alloc(qseecom.ion_clnt, size, 4096,
				ION_HEAP(ION_QSECOM_HEAP_ID), 0);
	if (IS_ERR_OR_NULL(data->client.ihandle)) {
		pr_err("Ion client could not retrieve the handle\n");
		kfree(data->sglistinfo_ptr);
		kfree(data);
		kfree(*handle);
		*handle = NULL;
@@ -4193,6 +4203,7 @@ int qseecom_start_app(struct qseecom_handle **handle,
	return 0;

err:
	kfree(data->sglistinfo_ptr);
	kfree(data);
	kfree(*handle);
	*handle = NULL;
@@ -4240,6 +4251,7 @@ int qseecom_shutdown_app(struct qseecom_handle **handle)

	mutex_unlock(&app_access_lock);
	if (ret == 0) {
		kzfree(data->sglistinfo_ptr);
		kzfree(data);
		kzfree(*handle);
		kzfree(kclient);