From: ebiederm@xmission.com (Eric W. Biederman)
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Andrew Morton <akpm@linux-foundation.org>,
ebiederm@xmission.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sysctl: Check length at deprecated_sysctl_warning.
Date: Tue, 13 Nov 2007 06:24:39 -0700 [thread overview]
Message-ID: <m1bq9y2s88.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <200711130350.lAD3oWnt054039@www262.sakura.ne.jp> (Tetsuo Handa's message of "Tue, 13 Nov 2007 12:50:32 +0900")
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> writes:
> Hello.
>
> Andrew Morton wrote:
>> I believe (args->nlen > CTL_MAXNAME) was correct.
> I'll leave it to you.
> But if you want to allow args->nlen == CTL_MAXNAME,
> you also need to update do_sysctl().
Which has been that way since before I decided to touch it. 2.6.12-rc1.
I haven't tracked it before then as I don't expect to see anything.
And that is why -ENOTDIR. That is the historical error code from sysctl in
this case.
> int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user
> *oldlenp,
> void __user *newval, size_t newlen)
> {
> ...
> if (nlen <= 0 || nlen >= CTL_MAXNAME)
> return -ENOTDIR;
> ...
> }
CTL_MAXNAME is fairly arbitrary, and since the set of binary paths is fixed.
So it feels to me like the code really should read:
if (nlen <= 0 || nlen > CTL_MAXNAME)
return -ENOTDIR;
In both places. Just because that is what the comment describes.
I think in reality CTL_MAXNAME is actually 5 but I would have to look a little
more closely to confirm that.
Eric
prev parent reply other threads:[~2007-11-13 13:25 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
2007-11-13 3:50 ` Tetsuo Handa
2007-11-13 13:24 ` Eric W. Biederman [this message]
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=m1bq9y2s88.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=akpm@linux-foundation.org \
--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