LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] sysctl: fix binary sysctl overflow
@ 2011-02-04 20:38 Lucian Adrian Grijincu
2011-02-04 21:09 ` Eric W. Biederman
0 siblings, 1 reply; 3+ messages in thread
From: Lucian Adrian Grijincu @ 2011-02-04 20:38 UTC (permalink / raw)
To: linux-kernel, Eric W. Biederman; +Cc: Lucian Adrian Grijincu
We allocated a vector of CTL_MAXNAME elements and considered
[0, CTL_MAXNAME] as valid indexes in the vector.
This fixes valid index range to be [0, CTL_MAXNAME).
I guess this should be backported to stable trees too.
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
---
kernel/sysctl_binary.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
index b875bed..e2f377c 100644
--- a/kernel/sysctl_binary.c
+++ b/kernel/sysctl_binary.c
@@ -1446,7 +1446,7 @@ static ssize_t do_sysctl(int __user *args_name, int nlen,
int i;
/* Check args->nlen. */
- if (nlen < 0 || nlen > CTL_MAXNAME)
+ if (nlen < 0 || nlen >= CTL_MAXNAME)
return -ENOTDIR;
/* Read in the sysctl name for simplicity */
for (i = 0; i < nlen; i++)
--
1.7.4.rc1.7.g2cf08.dirty
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sysctl: fix binary sysctl overflow
2011-02-04 20:38 [PATCH] sysctl: fix binary sysctl overflow Lucian Adrian Grijincu
@ 2011-02-04 21:09 ` Eric W. Biederman
2011-02-04 21:30 ` Lucian Adrian Grijincu
0 siblings, 1 reply; 3+ messages in thread
From: Eric W. Biederman @ 2011-02-04 21:09 UTC (permalink / raw)
To: Lucian Adrian Grijincu; +Cc: linux-kernel
Lucian Adrian Grijincu <lucian.grijincu@gmail.com> writes:
> We allocated a vector of CTL_MAXNAME elements and considered
> [0, CTL_MAXNAME] as valid indexes in the vector.
>
> This fixes valid index range to be [0, CTL_MAXNAME).
>
> I guess this should be backported to stable trees too.
No. This part of the code is correct. 0 is a valid index,
and the array is only CTL_MAXNAME entries long.
I think the maximum depth of this table is only about 6, but
feel free to count and tell me CTL_MAXNAME is set too low.
Eric
>
> Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
> ---
> kernel/sysctl_binary.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
> index b875bed..e2f377c 100644
> --- a/kernel/sysctl_binary.c
> +++ b/kernel/sysctl_binary.c
> @@ -1446,7 +1446,7 @@ static ssize_t do_sysctl(int __user *args_name, int nlen,
> int i;
>
> /* Check args->nlen. */
> - if (nlen < 0 || nlen > CTL_MAXNAME)
> + if (nlen < 0 || nlen >= CTL_MAXNAME)
> return -ENOTDIR;
> /* Read in the sysctl name for simplicity */
> for (i = 0; i < nlen; i++)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sysctl: fix binary sysctl overflow
2011-02-04 21:09 ` Eric W. Biederman
@ 2011-02-04 21:30 ` Lucian Adrian Grijincu
0 siblings, 0 replies; 3+ messages in thread
From: Lucian Adrian Grijincu @ 2011-02-04 21:30 UTC (permalink / raw)
To: Eric W. Biederman; +Cc: linux-kernel
On Fri, Feb 4, 2011 at 11:09 PM, Eric W. Biederman
<ebiederm@xmission.com> wrote:
> I think the maximum depth of this table is only about 6, but
> feel free to count and tell me CTL_MAXNAME is set too low.
Oh, you are right, after reading the code a bit more attentive I see
that the check was right from the start :)
Kids, don't drink and submit kernel patches :P
--
.
..: Lucian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-02-04 21:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-04 20:38 [PATCH] sysctl: fix binary sysctl overflow Lucian Adrian Grijincu
2011-02-04 21:09 ` Eric W. Biederman
2011-02-04 21:30 ` Lucian Adrian Grijincu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).