[uClinux-dev] [PATCH] : Avoid filename < TASK_SIZE test in do_getname() when no MMU

Mike Frysinger vapier at gentoo.org
Thu May 20 18:29:41 EDT 2010


dont know if David subscribes to this list ...

On Thursday 20 May 2010 04:14:45 Philippe De Muyter wrote:
> Hi Greg,
> 
> --
> Avoid filename < TASK_SIZE test in do_getname() when no MMU.
> 
> Without MMU, filenames can be anywhere in memory.  It is thus wrong to
> check that filename is before TASK_SIZE in do_getname().
> 
> Signed-off-by: Philippe De Muyter <phdm at macqel.be>
> ---
>  fs/namei.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index b86b96f..658bc1d 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -119,12 +119,14 @@ static int do_getname(const char __user *filename,
> char *page) int retval;
>  	unsigned long len = PATH_MAX;
> 
> +#ifdef CONFIG_MMU
>  	if (!segment_eq(get_fs(), KERNEL_DS)) {
>  		if ((unsigned long) filename >= TASK_SIZE)
>  			return -EFAULT;
>  		if (TASK_SIZE - (unsigned long) filename < PATH_MAX)
>  			len = TASK_SIZE - (unsigned long) filename;
>  	}
> +#endif
> 
>  	retval = strncpy_from_user(page, filename, len);
>  	if (retval > 0) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20100520/1080c692/attachment.sig>


More information about the uClinux-dev mailing list