public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3.8-stable] sched/debug: Fix sd->*_idx limit range avoiding overflow
@ 2013-04-15 14:15 Jonghwan Choi
  2013-04-16  1:53 ` libin
  0 siblings, 1 reply; 3+ messages in thread
From: Jonghwan Choi @ 2013-04-15 14:15 UTC (permalink / raw)
  To: libin
  Cc: stable, linux-kernel, jiang.liu, guohanjun, Peter Zijlstra,
	Ingo Molnar, Jonghwan Choi

From: libin <huawei.libin@huawei.com>

This patch looks like it should be in the 3.8-stable tree, should we apply
it?

------------------

From: "libin <huawei.libin@huawei.com>"

commit fd9b86d37a600488dbd80fe60cca46b822bff1cd upstream

Commit 201c373e8e ("sched/debug: Limit sd->*_idx range on
sysctl") was an incomplete bug fix.

This patch fixes sd->*_idx limit range to [0 ~ CPU_LOAD_IDX_MAX-1]
avoiding array overflow caused by setting sd->*_idx to CPU_LOAD_IDX_MAX
on sysctl.

Signed-off-by: Libin <huawei.libin@huawei.com>
Cc: <jiang.liu@huawei.com>
Cc: <guohanjun@huawei.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/51626610.2040607@huawei.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
---
 kernel/sched/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 26058d0..112a32a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4948,7 +4948,7 @@ static void sd_free_ctl_entry(struct ctl_table **tablep)
 }
 
 static int min_load_idx = 0;
-static int max_load_idx = CPU_LOAD_IDX_MAX;
+static int max_load_idx = CPU_LOAD_IDX_MAX-1;
 
 static void
 set_table_entry(struct ctl_table *entry,
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 3.8-stable] sched/debug: Fix sd->*_idx limit range avoiding overflow
  2013-04-15 14:15 [PATCH 3.8-stable] sched/debug: Fix sd->*_idx limit range avoiding overflow Jonghwan Choi
@ 2013-04-16  1:53 ` libin
  2013-04-16  9:15   ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: libin @ 2013-04-16  1:53 UTC (permalink / raw)
  To: Jonghwan Choi
  Cc: stable, linux-kernel, jiang.liu, guohanjun, Peter Zijlstra,
	Ingo Molnar, Jonghwan Choi

On 2013/4/15 22:15, Jonghwan Choi wrote:
> From: libin <huawei.libin@huawei.com>
> 
> This patch looks like it should be in the 3.8-stable tree, should we apply
> it?
> 

yes, I think this patch should be applied to the 3.8-stable tree. Thanks.
Libin

> ------------------
> 
> From: "libin <huawei.libin@huawei.com>"
> 
> commit fd9b86d37a600488dbd80fe60cca46b822bff1cd upstream
> 
> Commit 201c373e8e ("sched/debug: Limit sd->*_idx range on
> sysctl") was an incomplete bug fix.
> 
> This patch fixes sd->*_idx limit range to [0 ~ CPU_LOAD_IDX_MAX-1]
> avoiding array overflow caused by setting sd->*_idx to CPU_LOAD_IDX_MAX
> on sysctl.
> 
> Signed-off-by: Libin <huawei.libin@huawei.com>
> Cc: <jiang.liu@huawei.com>
> Cc: <guohanjun@huawei.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Link: http://lkml.kernel.org/r/51626610.2040607@huawei.com
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
> Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
> ---
>  kernel/sched/core.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 26058d0..112a32a 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4948,7 +4948,7 @@ static void sd_free_ctl_entry(struct ctl_table **tablep)
>  }
>  
>  static int min_load_idx = 0;
> -static int max_load_idx = CPU_LOAD_IDX_MAX;
> +static int max_load_idx = CPU_LOAD_IDX_MAX-1;
>  
>  static void
>  set_table_entry(struct ctl_table *entry,
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 3.8-stable] sched/debug: Fix sd->*_idx limit range avoiding overflow
  2013-04-16  1:53 ` libin
@ 2013-04-16  9:15   ` Ingo Molnar
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2013-04-16  9:15 UTC (permalink / raw)
  To: libin
  Cc: Jonghwan Choi, stable, linux-kernel, jiang.liu, guohanjun,
	Peter Zijlstra, Jonghwan Choi


* libin <huawei.libin@huawei.com> wrote:

> On 2013/4/15 22:15, Jonghwan Choi wrote:
> > From: libin <huawei.libin@huawei.com>
> > 
> > This patch looks like it should be in the 3.8-stable tree, should we apply
> > it?
> > 
> 
> yes, I think this patch should be applied to the 3.8-stable tree. Thanks.
> Libin

Since this is a debug interface only accessible to root it's not strictly 
necessary - but I have no objection to including it in -stable.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-16  9:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-15 14:15 [PATCH 3.8-stable] sched/debug: Fix sd->*_idx limit range avoiding overflow Jonghwan Choi
2013-04-16  1:53 ` libin
2013-04-16  9:15   ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox