The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: ebiederm@xmission.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sysctl: Check length at deprecated_sysctl_warning.
Date: Mon, 12 Nov 2007 19:13:20 -0800	[thread overview]
Message-ID: <20071112191320.55e49462.akpm@linux-foundation.org> (raw)
In-Reply-To: <200711130307.lAD37Nee045340@www262.sakura.ne.jp>

On Tue, 13 Nov 2007 12:07:23 +0900 Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> wrote:

> Andrew, please replace previous patch with this one.
> This one returns -ENOTDIR.
> ----------
> 
> Original patch forgot to check args->nlen.
> I don't know why args->nlen == CTL_MAXNAME is rejected,
> but it has been rejected traditionally.
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Cc: "Eric W. Biederman" <ebiederm@xmission.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  kernel/sysctl.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff -puN kernel/sysctl.c~sysctl-check-length-at-deprecated_sysctl_warning kernel/sysctl.c
> --- a/kernel/sysctl.c~sysctl-check-length-at-deprecated_sysctl_warning
> +++ a/kernel/sysctl.c
> @@ -2609,6 +2609,10 @@ static int deprecated_sysctl_warning(str
>  	int name[CTL_MAXNAME];
>  	int i;
>  
> +	/* Check args->nlen. */
> +	if (args->nlen <= 0 || args->nlen >= CTL_MAXNAME)

I believe (args->nlen > CTL_MAXNAME) was correct.

> +		return -ENOTDIR;

Ho hum.  Why does that code return -ENOTDIR on error anyway?

> +
>  	/* Read in the sysctl name for better debug message logging */
>  	for (i = 0; i < args->nlen; i++)
>  		if (get_user(name[i], args->name + i))

  reply	other threads:[~2007-11-13  3:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-08  2:57 [PATCH] sysctl: Check length at deprecated_sysctl_warning Tetsuo Handa
2007-11-08  3:22 ` Andrew Morton
2007-11-08  8:19   ` Tetsuo Handa
2007-11-12  9:44     ` Eric W. Biederman
2007-11-12 11:42       ` Tetsuo Handa
2007-11-13  3:07       ` Tetsuo Handa
2007-11-13  3:13         ` Andrew Morton [this message]
2007-11-13  3:50           ` Tetsuo Handa
2007-11-13 13:24             ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071112191320.55e49462.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox