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

Commit 970edf00 authored by Benjamin Chan's avatar Benjamin Chan
Browse files

msm: mdss: Add lock to avoid release of active session in rotator



Add mutex lock to protect an active rotator session from being closed.
Without the lock, this can happen if a rotator closing IOCTL is
called from a separate thread.

CRs-Fixed: 2006159
Change-Id: I927a0c626bdae5ef149e12979ec4befdbac1b7f7
Signed-off-by: default avatarBenjamin Chan <bkchan@codeaurora.org>
parent f5be93c4
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-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
@@ -2059,10 +2059,12 @@ static int mdss_rotator_config_session(struct mdss_rot_mgr *mgr,
		return ret;
	}

	mutex_lock(&mgr->lock);
	perf = mdss_rotator_find_session(private, config.session_id);
	if (!perf) {
		pr_err("No session with id=%u could be found\n",
			config.session_id);
		mutex_unlock(&mgr->lock);
		return -EINVAL;
	}

@@ -2085,6 +2087,7 @@ static int mdss_rotator_config_session(struct mdss_rot_mgr *mgr,
		config.output.format);
done:
	ATRACE_END(__func__);
	mutex_unlock(&mgr->lock);
	return ret;
}