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

Commit f5073b48 authored by Karthik Anantha Ram's avatar Karthik Anantha Ram Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: sync: Protect row state read



As part of the merge process, ensure we read the
correct state of the sync object.

Change-Id: Ifbf7932756b6ee50f5c0d983568bfc2e2870819f
Signed-off-by: default avatarKarthik Anantha Ram <kartanan@codeaurora.org>
parent ad82cb2a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -75,9 +75,11 @@ uint32_t cam_sync_util_get_group_object_state(struct sync_table_row *table,
	 * counts of error, active and success states of all children objects
	 */
	for (i = 0; i < num_objs; i++) {
		spin_lock_bh(&sync_dev->row_spinlocks[sync_objs[i]]);
		child_row = table + sync_objs[i];
		switch (child_row->state) {
		case CAM_SYNC_STATE_SIGNALED_ERROR:
			spin_unlock_bh(&sync_dev->row_spinlocks[sync_objs[i]]);
			return CAM_SYNC_STATE_SIGNALED_ERROR;
		case CAM_SYNC_STATE_SIGNALED_SUCCESS:
			success_count++;
@@ -88,8 +90,10 @@ uint32_t cam_sync_util_get_group_object_state(struct sync_table_row *table,
		default:
			CAM_ERR(CAM_SYNC,
				"Invalid state of child object during merge");
			spin_unlock_bh(&sync_dev->row_spinlocks[sync_objs[i]]);
			return CAM_SYNC_STATE_SIGNALED_ERROR;
		}
		spin_unlock_bh(&sync_dev->row_spinlocks[sync_objs[i]]);
	}

	if (active_count)