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

Commit 773b7b16 authored by Jayant Shekhar's avatar Jayant Shekhar
Browse files

msm: mdss: Fix race condition during mdp dump



In mdp debugfs, pipe, mixer, buffers and ctl information
is dumped. While dumping pipe buffer information using
pipe's buffer list, acquire list lock mutex. This is
done to prevent crash if at the same time buffer is freed
in commit thread.

Change-Id: Ibd26cc1484fb08ae7d0852f405100f6bbfa707de
Signed-off-by: default avatarJayant Shekhar <jshekhar@codeaurora.org>
parent 8069e329
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -1863,12 +1863,14 @@ static void __print_buf(struct seq_file *s, struct mdss_mdp_data *buf,
	seq_puts(s, "\n");
}

static void __dump_pipe(struct seq_file *s, struct mdss_mdp_pipe *pipe)
static void __dump_pipe(struct seq_file *s, struct mdss_mdp_pipe *pipe,
		struct msm_fb_data_type *mfd)
{
	struct mdss_mdp_data *buf;
	int format;
	int smps[4];
	int i;
	struct mdss_overlay_private *mdp5_data = mfd_to_mdp5_data(mfd);

	seq_printf(s, "\nSSPP #%d type=%s ndx=%x flags=0x%16llx play_cnt=%u xin_id=%d\n",
			pipe->num, mdss_mdp_pipetype2str(pipe->type),
@@ -1923,11 +1925,14 @@ static void __dump_pipe(struct seq_file *s, struct mdss_mdp_pipe *pipe)

	seq_puts(s, "Data:\n");

	mutex_lock(&mdp5_data->list_lock);
	list_for_each_entry(buf, &pipe->buf_queue, pipe_list)
		__print_buf(s, buf, false);
	mutex_unlock(&mdp5_data->list_lock);
}

static void __dump_mixer(struct seq_file *s, struct mdss_mdp_mixer *mixer)
static void __dump_mixer(struct seq_file *s, struct mdss_mdp_mixer *mixer,
		struct msm_fb_data_type *mfd)
{
	struct mdss_mdp_pipe *pipe;
	int i, cnt = 0;
@@ -1944,7 +1949,7 @@ static void __dump_mixer(struct seq_file *s, struct mdss_mdp_mixer *mixer)
	for (i = 0; i < ARRAY_SIZE(mixer->stage_pipe); i++) {
		pipe = mixer->stage_pipe[i];
		if (pipe) {
			__dump_pipe(s, pipe);
			__dump_pipe(s, pipe, mfd);
			cnt++;
		}
	}
@@ -2019,8 +2024,8 @@ static void __dump_ctl(struct seq_file *s, struct mdss_mdp_ctl *ctl)
	seq_printf(s, "Play Count=%u  Underrun Count=%u\n",
			ctl->play_cnt, ctl->underrun_cnt);

	__dump_mixer(s, ctl->mixer_left);
	__dump_mixer(s, ctl->mixer_right);
	__dump_mixer(s, ctl->mixer_left, ctl->mfd);
	__dump_mixer(s, ctl->mixer_right, ctl->mfd);
}

static int __dump_mdp(struct seq_file *s, struct mdss_data_type *mdata)