* [PATCH] Fix handling of parse errors in sysctl
@ 2011-01-05 17:08 ` Eric B Munson
0 siblings, 0 replies; 8+ messages in thread
From: Eric B Munson @ 2011-01-05 17:08 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, linux-mm, mel, caiqian, stable, Eric B Munson
This patch is a candidate for stable.
==== CUT HERE ====
When parsing changes to the huge page pool sizes made from userspace
via the sysctl interface, bogus input values are being covered up
by nr_hugepages_store_common and nr_overcommit_hugepages_store
returning 0 when strict_strtoul returns an error. This patch changes
the return value for these functions to -EINVAL when strict_strtoul
returns an error.
Reported-by: CAI Qian <caiqian@redhat.com>
Signed-off-by: Eric B Munson <emunson@mgebm.net>
---
mm/hugetlb.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 8585524..5cb71a9 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1440,7 +1440,7 @@ static ssize_t nr_hugepages_store_common(bool obey_mempolicy,
err = strict_strtoul(buf, 10, &count);
if (err)
- return 0;
+ return -EINVAL;
h = kobj_to_hstate(kobj, &nid);
if (nid == NUMA_NO_NODE) {
@@ -1519,7 +1519,7 @@ static ssize_t nr_overcommit_hugepages_store(struct kobject *kobj,
err = strict_strtoul(buf, 10, &input);
if (err)
- return 0;
+ return -EINVAL;
spin_lock(&hugetlb_lock);
h->nr_overcommit_huge_pages = input;
--
1.7.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] Fix handling of parse errors in sysctl
@ 2011-01-05 17:08 ` Eric B Munson
0 siblings, 0 replies; 8+ messages in thread
From: Eric B Munson @ 2011-01-05 17:08 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, linux-mm, mel, caiqian, stable, Eric B Munson
This patch is a candidate for stable.
==== CUT HERE ====
When parsing changes to the huge page pool sizes made from userspace
via the sysctl interface, bogus input values are being covered up
by nr_hugepages_store_common and nr_overcommit_hugepages_store
returning 0 when strict_strtoul returns an error. This patch changes
the return value for these functions to -EINVAL when strict_strtoul
returns an error.
Reported-by: CAI Qian <caiqian@redhat.com>
Signed-off-by: Eric B Munson <emunson@mgebm.net>
---
mm/hugetlb.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 8585524..5cb71a9 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1440,7 +1440,7 @@ static ssize_t nr_hugepages_store_common(bool obey_mempolicy,
err = strict_strtoul(buf, 10, &count);
if (err)
- return 0;
+ return -EINVAL;
h = kobj_to_hstate(kobj, &nid);
if (nid == NUMA_NO_NODE) {
@@ -1519,7 +1519,7 @@ static ssize_t nr_overcommit_hugepages_store(struct kobject *kobj,
err = strict_strtoul(buf, 10, &input);
if (err)
- return 0;
+ return -EINVAL;
spin_lock(&hugetlb_lock);
h->nr_overcommit_huge_pages = input;
--
1.7.1
--
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 policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix handling of parse errors in sysctl
2011-01-05 17:08 ` Eric B Munson
@ 2011-01-05 17:24 ` Mel Gorman
-1 siblings, 0 replies; 8+ messages in thread
From: Mel Gorman @ 2011-01-05 17:24 UTC (permalink / raw)
To: Eric B Munson; +Cc: akpm, linux-kernel, linux-mm, caiqian, stable
On Wed, Jan 05, 2011 at 10:08:49AM -0700, Eric B Munson wrote:
> This patch is a candidate for stable.
>
> ==== CUT HERE ====
>
> When parsing changes to the huge page pool sizes made from userspace
> via the sysctl interface, bogus input values are being covered up
> by nr_hugepages_store_common and nr_overcommit_hugepages_store
> returning 0 when strict_strtoul returns an error.
Not just that, it can infinite loop so it's a fairly serious problem.
> This patch changes
> the return value for these functions to -EINVAL when strict_strtoul
> returns an error.
>
> Reported-by: CAI Qian <caiqian@redhat.com>
>
> Signed-off-by: Eric B Munson <emunson@mgebm.net>
Acked-by: Mel Gorman <mel@csn.ul.ie>
> ---
> mm/hugetlb.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 8585524..5cb71a9 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1440,7 +1440,7 @@ static ssize_t nr_hugepages_store_common(bool obey_mempolicy,
>
> err = strict_strtoul(buf, 10, &count);
> if (err)
> - return 0;
> + return -EINVAL;
>
> h = kobj_to_hstate(kobj, &nid);
> if (nid == NUMA_NO_NODE) {
> @@ -1519,7 +1519,7 @@ static ssize_t nr_overcommit_hugepages_store(struct kobject *kobj,
>
> err = strict_strtoul(buf, 10, &input);
> if (err)
> - return 0;
> + return -EINVAL;
>
> spin_lock(&hugetlb_lock);
> h->nr_overcommit_huge_pages = input;
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix handling of parse errors in sysctl
@ 2011-01-05 17:24 ` Mel Gorman
0 siblings, 0 replies; 8+ messages in thread
From: Mel Gorman @ 2011-01-05 17:24 UTC (permalink / raw)
To: Eric B Munson; +Cc: akpm, linux-kernel, linux-mm, caiqian, stable
On Wed, Jan 05, 2011 at 10:08:49AM -0700, Eric B Munson wrote:
> This patch is a candidate for stable.
>
> ==== CUT HERE ====
>
> When parsing changes to the huge page pool sizes made from userspace
> via the sysctl interface, bogus input values are being covered up
> by nr_hugepages_store_common and nr_overcommit_hugepages_store
> returning 0 when strict_strtoul returns an error.
Not just that, it can infinite loop so it's a fairly serious problem.
> This patch changes
> the return value for these functions to -EINVAL when strict_strtoul
> returns an error.
>
> Reported-by: CAI Qian <caiqian@redhat.com>
>
> Signed-off-by: Eric B Munson <emunson@mgebm.net>
Acked-by: Mel Gorman <mel@csn.ul.ie>
> ---
> mm/hugetlb.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 8585524..5cb71a9 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1440,7 +1440,7 @@ static ssize_t nr_hugepages_store_common(bool obey_mempolicy,
>
> err = strict_strtoul(buf, 10, &count);
> if (err)
> - return 0;
> + return -EINVAL;
>
> h = kobj_to_hstate(kobj, &nid);
> if (nid == NUMA_NO_NODE) {
> @@ -1519,7 +1519,7 @@ static ssize_t nr_overcommit_hugepages_store(struct kobject *kobj,
>
> err = strict_strtoul(buf, 10, &input);
> if (err)
> - return 0;
> + return -EINVAL;
>
> spin_lock(&hugetlb_lock);
> h->nr_overcommit_huge_pages = input;
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--
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 policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [stable] [PATCH] Fix handling of parse errors in sysctl
2011-01-05 17:08 ` Eric B Munson
@ 2011-01-05 17:24 ` Greg KH
-1 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2011-01-05 17:24 UTC (permalink / raw)
To: Eric B Munson; +Cc: akpm, caiqian, mel, linux-kernel, linux-mm, stable
On Wed, Jan 05, 2011 at 10:08:49AM -0700, Eric B Munson wrote:
> This patch is a candidate for stable.
That's nice, but not how you get patches into the stable tree, sorry.
Please read Documentation/stable_kernel_rules.txt for how to do this.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [stable] [PATCH] Fix handling of parse errors in sysctl
@ 2011-01-05 17:24 ` Greg KH
0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2011-01-05 17:24 UTC (permalink / raw)
To: Eric B Munson; +Cc: akpm, caiqian, mel, linux-kernel, linux-mm, stable
On Wed, Jan 05, 2011 at 10:08:49AM -0700, Eric B Munson wrote:
> This patch is a candidate for stable.
That's nice, but not how you get patches into the stable tree, sorry.
Please read Documentation/stable_kernel_rules.txt for how to do this.
thanks,
greg k-h
--
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 policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix handling of parse errors in sysctl
2011-01-05 17:08 ` Eric B Munson
@ 2011-01-05 17:24 ` CAI Qian
-1 siblings, 0 replies; 8+ messages in thread
From: CAI Qian @ 2011-01-05 17:24 UTC (permalink / raw)
To: Eric B Munson; +Cc: linux-kernel, linux-mm, mel, stable, akpm
Just a minor issue.
----- Original Message -----
> This patch is a candidate for stable.
>
> ==== CUT HERE ====
>
> When parsing changes to the huge page pool sizes made from userspace
> via the sysctl interface, bogus input values are being covered up
Those are for sysfs code path. sysctl path should be handled by Michal's
patch touched hugetlb_sysctl_handler_common and hugetlb_overcommit_handler.
> by nr_hugepages_store_common and nr_overcommit_hugepages_store
> returning 0 when strict_strtoul returns an error. This patch changes
> the return value for these functions to -EINVAL when strict_strtoul
> returns an error.
>
> Reported-by: CAI Qian <caiqian@redhat.com>
>
> Signed-off-by: Eric B Munson <emunson@mgebm.net>
> ---
> mm/hugetlb.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 8585524..5cb71a9 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1440,7 +1440,7 @@ static ssize_t nr_hugepages_store_common(bool
> obey_mempolicy,
>
> err = strict_strtoul(buf, 10, &count);
> if (err)
> - return 0;
> + return -EINVAL;
>
> h = kobj_to_hstate(kobj, &nid);
> if (nid == NUMA_NO_NODE) {
> @@ -1519,7 +1519,7 @@ static ssize_t
> nr_overcommit_hugepages_store(struct kobject *kobj,
>
> err = strict_strtoul(buf, 10, &input);
> if (err)
> - return 0;
> + return -EINVAL;
>
> spin_lock(&hugetlb_lock);
> h->nr_overcommit_huge_pages = input;
> --
> 1.7.1
>
> --
> 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 policy in Canada: sign http://dissolvethecrtc.ca/
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix handling of parse errors in sysctl
@ 2011-01-05 17:24 ` CAI Qian
0 siblings, 0 replies; 8+ messages in thread
From: CAI Qian @ 2011-01-05 17:24 UTC (permalink / raw)
To: Eric B Munson; +Cc: linux-kernel, linux-mm, mel, stable, akpm
Just a minor issue.
----- Original Message -----
> This patch is a candidate for stable.
>
> ==== CUT HERE ====
>
> When parsing changes to the huge page pool sizes made from userspace
> via the sysctl interface, bogus input values are being covered up
Those are for sysfs code path. sysctl path should be handled by Michal's
patch touched hugetlb_sysctl_handler_common and hugetlb_overcommit_handler.
> by nr_hugepages_store_common and nr_overcommit_hugepages_store
> returning 0 when strict_strtoul returns an error. This patch changes
> the return value for these functions to -EINVAL when strict_strtoul
> returns an error.
>
> Reported-by: CAI Qian <caiqian@redhat.com>
>
> Signed-off-by: Eric B Munson <emunson@mgebm.net>
> ---
> mm/hugetlb.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 8585524..5cb71a9 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1440,7 +1440,7 @@ static ssize_t nr_hugepages_store_common(bool
> obey_mempolicy,
>
> err = strict_strtoul(buf, 10, &count);
> if (err)
> - return 0;
> + return -EINVAL;
>
> h = kobj_to_hstate(kobj, &nid);
> if (nid == NUMA_NO_NODE) {
> @@ -1519,7 +1519,7 @@ static ssize_t
> nr_overcommit_hugepages_store(struct kobject *kobj,
>
> err = strict_strtoul(buf, 10, &input);
> if (err)
> - return 0;
> + return -EINVAL;
>
> spin_lock(&hugetlb_lock);
> h->nr_overcommit_huge_pages = input;
> --
> 1.7.1
>
> --
> 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 policy in Canada: sign http://dissolvethecrtc.ca/
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
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 policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-01-05 17:25 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-05 17:08 [PATCH] Fix handling of parse errors in sysctl Eric B Munson
2011-01-05 17:08 ` Eric B Munson
2011-01-05 17:24 ` Mel Gorman
2011-01-05 17:24 ` Mel Gorman
2011-01-05 17:24 ` [stable] " Greg KH
2011-01-05 17:24 ` Greg KH
2011-01-05 17:24 ` CAI Qian
2011-01-05 17:24 ` CAI Qian
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.