Skip to content

Commit b94bf59

Browse files
myunghojKAGA-KOKO
authored andcommitted
timer/sysclt: Restrict timer migration sysctl values to 0 and 1
timer_migration sysctl acts as a boolean switch, so the allowed values should be restricted to 0 and 1. Add the necessary extra fields to the sysctl table entry to enforce that. [ tglx: Rewrote changelog ] Signed-off-by: Myungho Jung <mhjungk@gmail.com> Link: http://lkml.kernel.org/r/1492640690-3550-1-git-send-email-mhjungk@gmail.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent eb64522 commit b94bf59

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎kernel/sysctl.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,8 @@ static struct ctl_table kern_table[] = {
11761176
.maxlen = sizeof(unsigned int),
11771177
.mode = 0644,
11781178
.proc_handler = timer_migration_handler,
1179+
.extra1 = &zero,
1180+
.extra2 = &one,
11791181
},
11801182
#endif
11811183
#ifdef CONFIG_BPF_SYSCALL

‎kernel/time/timer.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ int timer_migration_handler(struct ctl_table *table, int write,
241241
int ret;
242242

243243
mutex_lock(&mutex);
244-
ret = proc_dointvec(table, write, buffer, lenp, ppos);
244+
ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
245245
if (!ret && write)
246246
timers_update_migration(false);
247247
mutex_unlock(&mutex);

0 commit comments

Comments
 (0)