* [PATCH] mm: fix devision by 0 in percpu_pagelist_fraction
@ 2012-04-28 14:25 ` Sasha Levin
0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2012-04-28 14:25 UTC (permalink / raw)
To: akpm, rohit.seth; +Cc: linux-mm, linux-kernel, Sasha Levin
percpu_pagelist_fraction_sysctl_handler() has only considered -EINVAL as a possible error
from proc_dointvec_minmax(). If any other error is returned, it would proceed to divide by
zero since percpu_pagelist_fraction wasn't getting initialized at any point. For example,
writing 0 bytes into the proc file would trigger the issue.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
mm/page_alloc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 1b951de..1e00729 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -106,7 +106,7 @@ unsigned long totalreserve_pages __read_mostly;
*/
unsigned long dirty_balance_reserve __read_mostly;
-int percpu_pagelist_fraction;
+int percpu_pagelist_fraction = 8;
gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK;
#ifdef CONFIG_PM_SLEEP
@@ -5271,7 +5271,7 @@ int percpu_pagelist_fraction_sysctl_handler(ctl_table *table, int write,
int ret;
ret = proc_dointvec_minmax(table, write, buffer, length, ppos);
- if (!write || (ret == -EINVAL))
+ if (!write || (ret < 0))
return ret;
for_each_populated_zone(zone) {
for_each_possible_cpu(cpu) {
--
1.7.8.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] mm: fix devision by 0 in percpu_pagelist_fraction
@ 2012-04-28 14:25 ` Sasha Levin
0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2012-04-28 14:25 UTC (permalink / raw)
To: akpm, rohit.seth; +Cc: linux-mm, linux-kernel, Sasha Levin
percpu_pagelist_fraction_sysctl_handler() has only considered -EINVAL as a possible error
from proc_dointvec_minmax(). If any other error is returned, it would proceed to divide by
zero since percpu_pagelist_fraction wasn't getting initialized at any point. For example,
writing 0 bytes into the proc file would trigger the issue.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
mm/page_alloc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 1b951de..1e00729 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -106,7 +106,7 @@ unsigned long totalreserve_pages __read_mostly;
*/
unsigned long dirty_balance_reserve __read_mostly;
-int percpu_pagelist_fraction;
+int percpu_pagelist_fraction = 8;
gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK;
#ifdef CONFIG_PM_SLEEP
@@ -5271,7 +5271,7 @@ int percpu_pagelist_fraction_sysctl_handler(ctl_table *table, int write,
int ret;
ret = proc_dointvec_minmax(table, write, buffer, length, ppos);
- if (!write || (ret == -EINVAL))
+ if (!write || (ret < 0))
return ret;
for_each_populated_zone(zone) {
for_each_possible_cpu(cpu) {
--
1.7.8.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: fix devision by 0 in percpu_pagelist_fraction
2012-04-28 14:25 ` Sasha Levin
@ 2012-04-30 2:30 ` Minchan Kim
-1 siblings, 0 replies; 4+ messages in thread
From: Minchan Kim @ 2012-04-30 2:30 UTC (permalink / raw)
To: Sasha Levin; +Cc: akpm, rohit.seth, linux-mm, linux-kernel
On 04/28/2012 11:25 PM, Sasha Levin wrote:
> percpu_pagelist_fraction_sysctl_handler() has only considered -EINVAL as a possible error
> from proc_dointvec_minmax(). If any other error is returned, it would proceed to divide by
> zero since percpu_pagelist_fraction wasn't getting initialized at any point. For example,
> writing 0 bytes into the proc file would trigger the issue.
>
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Reviewed-by: Minchan Kim <minchan@kernel.org>
--
Kind regards,
Minchan Kim
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: fix devision by 0 in percpu_pagelist_fraction
@ 2012-04-30 2:30 ` Minchan Kim
0 siblings, 0 replies; 4+ messages in thread
From: Minchan Kim @ 2012-04-30 2:30 UTC (permalink / raw)
To: Sasha Levin; +Cc: akpm, rohit.seth, linux-mm, linux-kernel
On 04/28/2012 11:25 PM, Sasha Levin wrote:
> percpu_pagelist_fraction_sysctl_handler() has only considered -EINVAL as a possible error
> from proc_dointvec_minmax(). If any other error is returned, it would proceed to divide by
> zero since percpu_pagelist_fraction wasn't getting initialized at any point. For example,
> writing 0 bytes into the proc file would trigger the issue.
>
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Reviewed-by: Minchan Kim <minchan@kernel.org>
--
Kind regards,
Minchan Kim
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-30 2:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-28 14:25 [PATCH] mm: fix devision by 0 in percpu_pagelist_fraction Sasha Levin
2012-04-28 14:25 ` Sasha Levin
2012-04-30 2:30 ` Minchan Kim
2012-04-30 2:30 ` Minchan Kim
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.