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

Commit 4b4f87ff authored by Amir Samuelov's avatar Amir Samuelov
Browse files

spcom: check user space command size



The user space spcomlib provides command buffer
for various commands.
Verify that the command buffer size matches the expected
command struct size.

CRs-Fixed: 1094143
Change-Id: If3ead54bd03368fa9338921e299b2ad8fb078297
Signed-off-by: default avatarAmir Samuelov <amirs@codeaurora.org>
parent 804ccaca
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1563,6 +1563,12 @@ static int spcom_handle_lock_ion_buf_command(struct spcom_channel *ch,
	struct ion_handle *ion_handle;
	int i;

	if (size != sizeof(*cmd)) {
		pr_err("cmd size [%d] , expected [%d].\n",
		       (int) size,  (int) sizeof(*cmd));
		return -EINVAL;
	}

	/* Check ION client */
	if (spcom_dev->ion_client == NULL) {
		pr_err("invalid ion client.\n");
@@ -1610,6 +1616,12 @@ static int spcom_handle_unlock_ion_buf_command(struct spcom_channel *ch,
	struct ion_client *ion_client = spcom_dev->ion_client;
	int i;

	if (size != sizeof(*cmd)) {
		pr_err("cmd size [%d] , expected [%d].\n",
		       (int) size,  (int) sizeof(*cmd));
		return -EINVAL;
	}

	/* Check ION client */
	if (ion_client == NULL) {
		pr_err("fail to create ion client.\n");