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

Commit 709d212a authored by Sumukh Hallymysore Ravindra's avatar Sumukh Hallymysore Ravindra
Browse files

msm: synx: acquire mutex through loop index



Acquire the mutex during cleanup from the loop index
rather than the index saved in the synx object as
it could lead to potential deadlock with object
allocation.

Change-Id: I2bc84b67dd039521053f000e2d1715339789f5e1
Signed-off-by: default avatarSumukh Hallymysore Ravindra <shallymy@codeaurora.org>
parent 3423e083
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-License-Identifier: GPL-2.0-only
/*
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 */
 */
#define pr_fmt(fmt) "synx: " fmt
#define pr_fmt(fmt) "synx: " fmt


@@ -1327,7 +1327,7 @@ static void synx_object_cleanup(struct synx_client *client)
		struct synx_table_row *row =
		struct synx_table_row *row =
			synx_dev->synx_table + i;
			synx_dev->synx_table + i;


		mutex_lock(&synx_dev->row_locks[row->index]);
		mutex_lock(&synx_dev->row_locks[i]);
		if (row->index) {
		if (row->index) {
			list_for_each_entry_safe(payload_info,
			list_for_each_entry_safe(payload_info,
				temp_payload_info,
				temp_payload_info,
@@ -1339,7 +1339,7 @@ static void synx_object_cleanup(struct synx_client *client)
				}
				}
			}
			}
		}
		}
		mutex_unlock(&synx_dev->row_locks[row->index]);
		mutex_unlock(&synx_dev->row_locks[i]);
	}
	}
}
}