Unverified Commit 78fcf755 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!6662 sched/rt: Disallow writing invalid values to sched_rt_period_us

parents d8171945 88da0ed4
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -2655,9 +2655,6 @@ static int sched_rt_global_constraints(void)

static int sched_rt_global_validate(void)
{
	if (sysctl_sched_rt_period <= 0)
		return -EINVAL;

	if ((sysctl_sched_rt_runtime != RUNTIME_INF) &&
		(sysctl_sched_rt_runtime > sysctl_sched_rt_period))
		return -EINVAL;
@@ -2687,7 +2684,7 @@ int sched_rt_handler(struct ctl_table *table, int write,
	old_period = sysctl_sched_rt_period;
	old_runtime = sysctl_sched_rt_runtime;

	ret = proc_dointvec(table, write, buffer, lenp, ppos);
	ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);

	if (!ret && write) {
		ret = sched_rt_global_validate();
+5 −0
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ static int __maybe_unused three = 3;
static int __maybe_unused four = 4;
static int __maybe_unused five = 5;
static int __maybe_unused uce_kernel_recovery_max = 31;
static int int_max = INT_MAX;
static unsigned long zero_ul;
static unsigned long one_ul = 1;
static unsigned long long_max = LONG_MAX;
@@ -463,6 +464,8 @@ static struct ctl_table kern_table[] = {
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= sched_rt_handler,
		.extra1		= &one,
		.extra2		= &int_max,
	},
	{
		.procname	= "sched_rt_runtime_us",
@@ -470,6 +473,8 @@ static struct ctl_table kern_table[] = {
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= sched_rt_handler,
		.extra1		= &neg_one,
		.extra2		= &int_max,
	},
	{
		.procname	= "sched_rr_timeslice_ms",