From 91bd0dce3b29738befd8912a569a2240df89a49e Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Fri, 9 Apr 2021 09:43:46 +0530 Subject: [PATCH] sched/walt: Read sysctl_sched_ravg_window_nr_ticks under mutex When sched_ravg_window_nr_ticks tunable is read and write concurrently, the read can return the previous value though the write is already happened. Fix this by reading the sysctl_sched_ravg_window_nr_ticks value under mutex. Change-Id: Ie1146c47ac1a184fc8bf4a2824bf6db28fd7156d Signed-off-by: Pavankumar Kondeti --- kernel/sched/walt/sysctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/walt/sysctl.c b/kernel/sched/walt/sysctl.c index 8cefdeeede32..4816d702c790 100644 --- a/kernel/sched/walt/sysctl.c +++ b/kernel/sched/walt/sysctl.c @@ -171,7 +171,7 @@ static int sched_ravg_window_handler(struct ctl_table *table, { int ret = -EPERM; static DEFINE_MUTEX(mutex); - int val = sysctl_sched_ravg_window_nr_ticks; + int val; struct ctl_table tmp = { .data = &val, @@ -184,6 +184,7 @@ static int sched_ravg_window_handler(struct ctl_table *table, if (write && HZ != 250) goto unlock; + val = sysctl_sched_ravg_window_nr_ticks; ret = proc_dointvec(&tmp, write, buffer, lenp, ppos); if (ret || !write || (val == sysctl_sched_ravg_window_nr_ticks)) goto unlock;