LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ian Kent <raven@themaw.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	autofs@linux.kernel.org
Subject: Re: [PATCH 2/6] autofs4 - remove string terminator check
Date: Tue, 28 Oct 2008 09:27:02 +0900	[thread overview]
Message-ID: <1225153622.2938.1.camel@zeus.themaw.net> (raw)
In-Reply-To: <20081027133131.f2011d28.akpm@linux-foundation.org>

On Mon, 2008-10-27 at 13:31 -0700, Andrew Morton wrote:
> On Thu, 23 Oct 2008 10:35:22 +0800
> Ian Kent <raven@themaw.net> wrote:
> 
> > Remove unnecessary string terminator check.
> 
> Why is it unnecessary?
> 
> Does this change alter behaviour in any way?
> 
> Does it fix a bug?

Umm .... it was done in response to your comment, quoted below ...

> +/*
> + * Check a string doesn't overrun the chunk of
> + * memory we copied from user land.
> + */
> +static int invalid_str(char *str, void *end)
> +{
> +     while ((void *) str <= end)
> +             if (!*str++)
> +                     return 0;
> +     return -EINVAL;
> +}

What is this?  We copy strings in from userspace in 10000 different
places without needing checks such as this?

> 
> Better changelogs, please....
> 
> > --- a/fs/autofs4/dev-ioctl.c
> > +++ b/fs/autofs4/dev-ioctl.c
> > @@ -51,18 +51,6 @@ static int check_name(const char *name)
> >  }
> >  
> >  /*
> > - * Check a string doesn't overrun the chunk of
> > - * memory we copied from user land.
> > - */
> > -static int invalid_str(char *str, void *end)
> > -{
> > -	while ((void *) str <= end)
> > -		if (!*str++)
> > -			return 0;
> > -	return -EINVAL;
> > -}
> > -
> > -/*
> >   * Check that the user compiled against correct version of autofs
> >   * misc device code.
> >   *
> > @@ -143,14 +131,6 @@ static int validate_dev_ioctl(int cmd, struct autofs_dev_ioctl *param)
> >  				    cmd);
> >  			goto out;
> >  		}
> > -
> > -		err = invalid_str(param->path,
> > -				 (void *) ((size_t) param + param->size));
> > -		if (err) {
> > -			AUTOFS_WARN("invalid path supplied for cmd(0x%08x)",
> > -				    cmd);
> > -			goto out;
> > -		}
> >  	}
> >  
> >  	err = 0;


  reply	other threads:[~2008-10-28  0:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-23  2:35 [PATCH 1/6] autofs4 - correct offset mount expire check Ian Kent
2008-10-23  2:35 ` [PATCH 2/6] autofs4 - remove string terminator check Ian Kent
2008-10-27 20:31   ` Andrew Morton
2008-10-28  0:27     ` Ian Kent [this message]
2008-10-28  0:55       ` Andrew Morton
2008-10-28  1:04         ` Ian Kent
2008-10-28  1:02       ` Ian Kent
2008-10-23  2:35 ` [PATCH 3/6] autofs4 - collect version check return Ian Kent
2008-10-23  2:35 ` [PATCH 4/6] autofs4 - make autofs type usage explicit Ian Kent
2008-10-27 20:40   ` Andrew Morton
2008-10-28  0:28     ` Ian Kent
2008-10-28 13:24     ` Jeff Moyer
2008-10-23  2:35 ` [PATCH 5/6] autofs4 - improve parameter usage Ian Kent
2008-10-23  2:35 ` [PATCH 6/6] autofs4 - cleanup expire code duplication Ian Kent

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=1225153622.2938.1.camel@zeus.themaw.net \
    --to=raven@themaw.net \
    --cc=akpm@linux-foundation.org \
    --cc=autofs@linux.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).