* [BUG] timer_migration interface accepts any number as input in 2.6.30-git9 @ 2009-06-17 9:12 poornima nayak 2009-06-17 10:21 ` Arun R Bharadwaj 2009-06-17 10:41 ` [BUG] timer_migration interface accepts any number as input in 2.6.30-git9 Jaswinder Singh Rajput 0 siblings, 2 replies; 7+ messages in thread From: poornima nayak @ 2009-06-17 9:12 UTC (permalink / raw) To: linux-kernel; +Cc: arun Hi Timer migration interface /proc/sys/kernel/timer_migration in 2.6.30-git9 accepts any numerical value as input. Steps to reproduce 1. echo -6666666 > /proc/sys/kernel/timer_migration 2. cat /proc/sys/kernel/timer_migration -6666666 1. echo 44444444444444444444444444444444444444444444444444444444444 > /proc/sys/kernel/timer_migration 2. cat /proc/sys/kernel/timer_migration -1357789412 Expected behavior: Should 'echo: write error: Invalid argument' while setting any value other then 0 & 1 Regards Poornima ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [BUG] timer_migration interface accepts any number as input in 2.6.30-git9 2009-06-17 9:12 [BUG] timer_migration interface accepts any number as input in 2.6.30-git9 poornima nayak @ 2009-06-17 10:21 ` Arun R Bharadwaj 2009-06-17 10:41 ` Amerigo Wang 2009-06-22 11:22 ` poornima nayak 2009-06-17 10:41 ` [BUG] timer_migration interface accepts any number as input in 2.6.30-git9 Jaswinder Singh Rajput 1 sibling, 2 replies; 7+ messages in thread From: Arun R Bharadwaj @ 2009-06-17 10:21 UTC (permalink / raw) To: poornima nayak; +Cc: linux-kernel * poornima nayak <mpnayak@linux.vnet.ibm.com> [2009-06-17 14:42:16]: > Hi > > Timer migration interface /proc/sys/kernel/timer_migration in > 2.6.30-git9 accepts any numerical value as input. > Steps to reproduce > 1. echo -6666666 > /proc/sys/kernel/timer_migration > 2. cat /proc/sys/kernel/timer_migration > -6666666 > > 1. echo 44444444444444444444444444444444444444444444444444444444444 > /proc/sys/kernel/timer_migration > 2. cat /proc/sys/kernel/timer_migration > -1357789412 > > Expected behavior: Should 'echo: write error: Invalid argument' while > setting any value other then 0 & 1 > > Regards > Poornima > Hi Poornima, Thanks for reporting the bug. Hope this patch removes the bug. The patch is based against the latest -tip/master. --arun Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com> --- kernel/sysctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) Index: linux.trees.git/kernel/sysctl.c =================================================================== --- linux.trees.git.orig/kernel/sysctl.c +++ linux.trees.git/kernel/sysctl.c @@ -335,7 +335,10 @@ static struct ctl_table kern_table[] = { .data = &sysctl_timer_migration, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec_minmax, + .strategy = &sysctl_intvec, + .extra1 = &zero, + .extra2 = &one, }, #endif { ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [BUG] timer_migration interface accepts any number as input in 2.6.30-git9 2009-06-17 10:21 ` Arun R Bharadwaj @ 2009-06-17 10:41 ` Amerigo Wang 2009-06-22 11:22 ` poornima nayak 1 sibling, 0 replies; 7+ messages in thread From: Amerigo Wang @ 2009-06-17 10:41 UTC (permalink / raw) To: Arun R Bharadwaj; +Cc: poornima nayak, linux-kernel On Wed, Jun 17, 2009 at 03:51:26PM +0530, Arun R Bharadwaj wrote: >* poornima nayak <mpnayak@linux.vnet.ibm.com> [2009-06-17 14:42:16]: > >> Hi >> >> Timer migration interface /proc/sys/kernel/timer_migration in >> 2.6.30-git9 accepts any numerical value as input. >> Steps to reproduce >> 1. echo -6666666 > /proc/sys/kernel/timer_migration >> 2. cat /proc/sys/kernel/timer_migration >> -6666666 >> >> 1. echo 44444444444444444444444444444444444444444444444444444444444 > /proc/sys/kernel/timer_migration >> 2. cat /proc/sys/kernel/timer_migration >> -1357789412 >> >> Expected behavior: Should 'echo: write error: Invalid argument' while >> setting any value other then 0 & 1 >> >> Regards >> Poornima >> > >Hi Poornima, > >Thanks for reporting the bug. >Hope this patch removes the bug. >The patch is based against the latest -tip/master. > >--arun > > >Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com> Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com> My fix goes further, the further part of it is shown below. :) Mind to have a look? Not tested yet. Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> ----- diff --git a/kernel/sysctl.c b/kernel/sysctl.c index ab462b9..bc27e00 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2331,7 +2331,8 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, if (*p < '0' || *p > '9') break; - lval = simple_strtoul(p, &p, 0); + if (strict_strtoul(p, 0, &lval)) + return -EINVAL; len = p-buf; if ((len < left) && *p && !isspace(*p)) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 756ccaf..ff2ca5c 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -163,11 +163,14 @@ int strict_strtoul(const char *cp, unsigned int base, unsigned long *res) char *tail; unsigned long val; size_t len; + char tmp[32]; *res = 0; len = strlen(cp); if (len == 0) return -EINVAL; + if (len > snprintf(tmp, "%ld", ULONG_MAX)) + return -EINVAL; val = simple_strtoul(cp, &tail, base); if (tail == cp) ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [BUG] timer_migration interface accepts any number as input in 2.6.30-git9 2009-06-17 10:21 ` Arun R Bharadwaj 2009-06-17 10:41 ` Amerigo Wang @ 2009-06-22 11:22 ` poornima nayak 2009-06-23 4:30 ` Arun R Bharadwaj 1 sibling, 1 reply; 7+ messages in thread From: poornima nayak @ 2009-06-22 11:22 UTC (permalink / raw) To: arun; +Cc: linux-kernel Hi Arun, Patch given by you fixes the reported bug. Regds Poornima On Wed, 2009-06-17 at 15:51 +0530, Arun R Bharadwaj wrote: > * poornima nayak <mpnayak@linux.vnet.ibm.com> [2009-06-17 14:42:16]: > > > Hi > > > > Timer migration interface /proc/sys/kernel/timer_migration in > > 2.6.30-git9 accepts any numerical value as input. > > Steps to reproduce > > 1. echo -6666666 > /proc/sys/kernel/timer_migration > > 2. cat /proc/sys/kernel/timer_migration > > -6666666 > > > > 1. echo 44444444444444444444444444444444444444444444444444444444444 > /proc/sys/kernel/timer_migration > > 2. cat /proc/sys/kernel/timer_migration > > -1357789412 > > > > Expected behavior: Should 'echo: write error: Invalid argument' while > > setting any value other then 0 & 1 > > > > Regards > > Poornima > > > > Hi Poornima, > > Thanks for reporting the bug. > Hope this patch removes the bug. > The patch is based against the latest -tip/master. > > --arun > > > Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com> > --- > kernel/sysctl.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > Index: linux.trees.git/kernel/sysctl.c > =================================================================== > --- linux.trees.git.orig/kernel/sysctl.c > +++ linux.trees.git/kernel/sysctl.c > @@ -335,7 +335,10 @@ static struct ctl_table kern_table[] = { > .data = &sysctl_timer_migration, > .maxlen = sizeof(unsigned int), > .mode = 0644, > - .proc_handler = &proc_dointvec, > + .proc_handler = &proc_dointvec_minmax, > + .strategy = &sysctl_intvec, > + .extra1 = &zero, > + .extra2 = &one, > }, > #endif > { > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [BUG] timer_migration interface accepts any number as input in 2.6.30-git9 2009-06-22 11:22 ` poornima nayak @ 2009-06-23 4:30 ` Arun R Bharadwaj 2009-06-23 8:51 ` [tip:timers/urgent] timers: Fix timer_migration interface which accepts any number as input tip-bot for Arun R Bharadwaj 0 siblings, 1 reply; 7+ messages in thread From: Arun R Bharadwaj @ 2009-06-23 4:30 UTC (permalink / raw) To: mingo; +Cc: linux-kernel, poornima nayak, Arun Bharadwaj * poornima nayak <mpnayak@linux.vnet.ibm.com> [2009-06-22 16:52:08]: > Hi Arun, > > Patch given by you fixes the reported bug. > > Regds > Poornima Hi Ingo, Can you please include this minor interface bug fix for timer migration? thanks, Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com> Reported-by: Poornima Nayak <mpnayak@linux.vnet.ibm.com> Tested-by: Poornima Nayak <mpnayak@linux.vnet.ibm.com> --- kernel/sysctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) Index: linux.trees.git/kernel/sysctl.c =================================================================== --- linux.trees.git.orig/kernel/sysctl.c +++ linux.trees.git/kernel/sysctl.c @@ -335,7 +335,10 @@ static struct ctl_table kern_table[] = { .data = &sysctl_timer_migration, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec_minmax, + .strategy = &sysctl_intvec, + .extra1 = &zero, + .extra2 = &one, }, #endif { > On Wed, 2009-06-17 at 15:51 +0530, Arun R Bharadwaj wrote: > > * poornima nayak <mpnayak@linux.vnet.ibm.com> [2009-06-17 14:42:16]: > > > > > Hi > > > > > > Timer migration interface /proc/sys/kernel/timer_migration in > > > 2.6.30-git9 accepts any numerical value as input. > > > Steps to reproduce > > > 1. echo -6666666 > /proc/sys/kernel/timer_migration > > > 2. cat /proc/sys/kernel/timer_migration > > > -6666666 > > > > > > 1. echo 44444444444444444444444444444444444444444444444444444444444 > /proc/sys/kernel/timer_migration > > > 2. cat /proc/sys/kernel/timer_migration > > > -1357789412 > > > > > > Expected behavior: Should 'echo: write error: Invalid argument' while > > > setting any value other then 0 & 1 > > > > > > Regards > > > Poornima > > > > > > > Hi Poornima, > > > > Thanks for reporting the bug. > > Hope this patch removes the bug. > > The patch is based against the latest -tip/master. > > > > --arun > > > > > > Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com> > > --- > > kernel/sysctl.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > Index: linux.trees.git/kernel/sysctl.c > > =================================================================== > > --- linux.trees.git.orig/kernel/sysctl.c > > +++ linux.trees.git/kernel/sysctl.c > > @@ -335,7 +335,10 @@ static struct ctl_table kern_table[] = { > > .data = &sysctl_timer_migration, > > .maxlen = sizeof(unsigned int), > > .mode = 0644, > > - .proc_handler = &proc_dointvec, > > + .proc_handler = &proc_dointvec_minmax, > > + .strategy = &sysctl_intvec, > > + .extra1 = &zero, > > + .extra2 = &one, > > }, > > #endif > > { > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > Please read the FAQ at http://www.tux.org/lkml/ > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [tip:timers/urgent] timers: Fix timer_migration interface which accepts any number as input 2009-06-23 4:30 ` Arun R Bharadwaj @ 2009-06-23 8:51 ` tip-bot for Arun R Bharadwaj 0 siblings, 0 replies; 7+ messages in thread From: tip-bot for Arun R Bharadwaj @ 2009-06-23 8:51 UTC (permalink / raw) To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, arun, tglx, mingo, mpnayak Commit-ID: bfdb4d9f0f611687d71cf6a460efc9e755f4a462 Gitweb: http://git.kernel.org/tip/bfdb4d9f0f611687d71cf6a460efc9e755f4a462 Author: Arun R Bharadwaj <arun@linux.vnet.ibm.com> AuthorDate: Tue, 23 Jun 2009 10:00:58 +0530 Committer: Ingo Molnar <mingo@elte.hu> CommitDate: Tue, 23 Jun 2009 10:49:33 +0200 timers: Fix timer_migration interface which accepts any number as input Poornima Nayek reported: | Timer migration interface /proc/sys/kernel/timer_migration in | 2.6.30-git9 accepts any numerical value as input. | | Steps to reproduce: | 1. echo -6666666 > /proc/sys/kernel/timer_migration | 2. cat /proc/sys/kernel/timer_migration | -6666666 | | 1. echo 44444444444444444444444444444444444444444444444444444444444 > /proc/sys/kernel/timer_migration | 2. cat /proc/sys/kernel/timer_migration | -1357789412 | | Expected behavior: Should 'echo: write error: Invalid argument' while | setting any value other then 0 & 1 Restrict valid values to 0 and 1. Reported-by: Poornima Nayak <mpnayak@linux.vnet.ibm.com> Tested-by: Poornima Nayak <mpnayak@linux.vnet.ibm.com> Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com> Cc: poornima nayak <mpnayak@linux.vnet.ibm.com> Cc: Arun Bharadwaj <arun@linux.vnet.ibm.com> LKML-Reference: <20090623043058.GA3249@linux.vnet.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> --- kernel/sysctl.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 62e4ff9..c428ba1 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -335,7 +335,10 @@ static struct ctl_table kern_table[] = { .data = &sysctl_timer_migration, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec_minmax, + .strategy = &sysctl_intvec, + .extra1 = &zero, + .extra2 = &one, }, #endif { ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [BUG] timer_migration interface accepts any number as input in 2.6.30-git9 2009-06-17 9:12 [BUG] timer_migration interface accepts any number as input in 2.6.30-git9 poornima nayak 2009-06-17 10:21 ` Arun R Bharadwaj @ 2009-06-17 10:41 ` Jaswinder Singh Rajput 1 sibling, 0 replies; 7+ messages in thread From: Jaswinder Singh Rajput @ 2009-06-17 10:41 UTC (permalink / raw) To: poornima nayak Cc: linux-kernel, arun, Ingo Molnar, Thomas Gleixner, x86 maintainers, LKML On Wed, 2009-06-17 at 14:42 +0530, poornima nayak wrote: > Hi > > Timer migration interface /proc/sys/kernel/timer_migration in > 2.6.30-git9 accepts any numerical value as input. > Steps to reproduce > 1. echo -6666666 > /proc/sys/kernel/timer_migration > 2. cat /proc/sys/kernel/timer_migration > -6666666 > > 1. echo 44444444444444444444444444444444444444444444444444444444444 > /proc/sys/kernel/timer_migration > 2. cat /proc/sys/kernel/timer_migration > -1357789412 > > Expected behavior: Should 'echo: write error: Invalid argument' while > setting any value other then 0 & 1 > Is this patch fix your problem: [PATCH] kernel/sysctl: fix timer migration interface Timer migration interface /proc/sys/kernel/timer_migration in 2.6.30-git9 accepts any numerical value as input. Steps to reproduce 1. echo -6666666 > /proc/sys/kernel/timer_migration 2. cat /proc/sys/kernel/timer_migration -6666666 1. echo 44444444444444444444444444444444444444444444444444444444444 > /proc/sys/kernel/timer_migration 2. cat /proc/sys/kernel/timer_migration -1357789412 Expected behavior: Should 'echo: write error: Invalid argument' while setting any value other then 0 & 1 Reported-by: Poornima Nayak <mpnayak@linux.vnet.ibm.com> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com> --- kernel/sysctl.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index ac57832..d0f65e4 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -334,7 +334,10 @@ static struct ctl_table kern_table[] = { .data = &sysctl_timer_migration, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec_minmax, + .strategy = &sysctl_intvec, + .extra1 = &zero, + .extra2 = &one, }, #endif { -- 1.6.0.6 ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-06-23 8:52 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-06-17 9:12 [BUG] timer_migration interface accepts any number as input in 2.6.30-git9 poornima nayak 2009-06-17 10:21 ` Arun R Bharadwaj 2009-06-17 10:41 ` Amerigo Wang 2009-06-22 11:22 ` poornima nayak 2009-06-23 4:30 ` Arun R Bharadwaj 2009-06-23 8:51 ` [tip:timers/urgent] timers: Fix timer_migration interface which accepts any number as input tip-bot for Arun R Bharadwaj 2009-06-17 10:41 ` [BUG] timer_migration interface accepts any number as input in 2.6.30-git9 Jaswinder Singh Rajput
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.