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

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

Merge "msm:cci: Add protection for race condition in cci queue access"

parents 4ce3eaf8 2bc5c937
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1284,6 +1284,10 @@ static int32_t msm_cci_init(struct v4l2_subdev *sd,
		CDBG("%s:%d master %d\n", __func__, __LINE__, master);
		if (master < MASTER_MAX && master >= 0) {
			mutex_lock(&cci_dev->cci_master_info[master].mutex);
			mutex_lock(&cci_dev->cci_master_info[master].
				mutex_q[PRIORITY_QUEUE]);
			mutex_lock(&cci_dev->cci_master_info[master].
				mutex_q[SYNC_QUEUE]);
			flush_workqueue(cci_dev->write_wq[master]);
			/* Re-initialize the completion */
			reinit_completion(&cci_dev->
@@ -1308,6 +1312,10 @@ static int32_t msm_cci_init(struct v4l2_subdev *sd,
			if (rc <= 0)
				pr_err("%s:%d wait failed %d\n", __func__,
					__LINE__, rc);
			mutex_unlock(&cci_dev->cci_master_info[master].
				mutex_q[SYNC_QUEUE]);
			mutex_unlock(&cci_dev->cci_master_info[master].
				mutex_q[PRIORITY_QUEUE]);
			mutex_unlock(&cci_dev->cci_master_info[master].mutex);
		}
		return 0;