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

Commit 2b088298 authored by Rishabh Jain's avatar Rishabh Jain
Browse files

msm: camera: cpas: Avoid array underflow during client registration



CPAS driver maintains an array of clients and accordingly takes the
lock on them. While registering the client if the client name is not
present in the existing clients' list, CPAS driver should avoid the
registration and throw error.
This change introduces the same and hence avoiding array underflow.

Change-Id: I537b99b0b1e76afa60834f546dfc2e622b203dac
Signed-off-by: default avatarRishabh Jain <risjai@codeaurora.org>
parent 45290a83
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1234,6 +1234,13 @@ static int cam_cpas_hw_register_client(struct cam_hw_info *cpas_hw,
	rc = cam_common_util_get_string_index(soc_private->client_name,
		soc_private->num_clients, client_name, &client_indx);

	if (rc) {
		CAM_ERR(CAM_CPAS, "No match found for client %s",
			client_name);
		mutex_unlock(&cpas_hw->hw_mutex);
		return rc;
	}

	mutex_lock(&cpas_core->client_mutex[client_indx]);

	if (rc || !CAM_CPAS_CLIENT_VALID(client_indx) ||