netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: dev_ifname32() fails on 32->64bit calls in copy_in_user().
       [not found] <20071031003850.GE7517@tasint.org>
@ 2007-10-31  2:35 ` Benjamin Herrenschmidt
  2007-10-31  3:41   ` David Miller
  2007-10-31  8:03   ` Eric W. Biederman
  0 siblings, 2 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2007-10-31  2:35 UTC (permalink / raw)
  To: Joel Becker
  Cc: Linux Netdev, Linux Kernel Mailing List, Eric W. Biederman,
	David S. Miller

Bug is in the new dev_ifname32:

	uifr = compat_alloc_user_space(sizeof(struct ifreq));
	if (copy_in_user(uifr, compat_ptr(arg), sizeof(struct ifreq32)));
		return -EFAULT;

There's a stray ";" after the if statement, that was obviously not
tested :-)

This fixes it here (tested):
----------------------------------------------------------------------------
[PATCH] Fix new dev_ifname32 returning -EFAULT

A stray semicolon slipped in the patch that updated dev_ifname32 to
not be inline, causing it to always return -EFAULT. This fixes it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

Index: linux-work/fs/compat_ioctl.c
===================================================================
--- linux-work.orig/fs/compat_ioctl.c	2007-10-31 13:30:42.000000000 +1100
+++ linux-work/fs/compat_ioctl.c	2007-10-31 13:30:46.000000000 +1100
@@ -322,7 +322,7 @@ static int dev_ifname32(unsigned int fd,
 	int err;
 
 	uifr = compat_alloc_user_space(sizeof(struct ifreq));
-	if (copy_in_user(uifr, compat_ptr(arg), sizeof(struct ifreq32)));
+	if (copy_in_user(uifr, compat_ptr(arg), sizeof(struct ifreq32)))
 		return -EFAULT;
 
 	err = sys_ioctl(fd, SIOCGIFNAME, (unsigned long)uifr);



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dev_ifname32() fails on 32->64bit calls in copy_in_user().
  2007-10-31  2:35 ` dev_ifname32() fails on 32->64bit calls in copy_in_user() Benjamin Herrenschmidt
@ 2007-10-31  3:41   ` David Miller
  2007-10-31  8:03   ` Eric W. Biederman
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2007-10-31  3:41 UTC (permalink / raw)
  To: benh; +Cc: Joel.Becker, netdev, Linux-Kernel, ebiederm

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: Wed, 31 Oct 2007 13:35:24 +1100

> [PATCH] Fix new dev_ifname32 returning -EFAULT
> 
> A stray semicolon slipped in the patch that updated dev_ifname32 to
> not be inline, causing it to always return -EFAULT. This fixes it.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Applied, thanks for the fix Ben!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dev_ifname32() fails on 32->64bit calls in copy_in_user().
  2007-10-31  2:35 ` dev_ifname32() fails on 32->64bit calls in copy_in_user() Benjamin Herrenschmidt
  2007-10-31  3:41   ` David Miller
@ 2007-10-31  8:03   ` Eric W. Biederman
  1 sibling, 0 replies; 3+ messages in thread
From: Eric W. Biederman @ 2007-10-31  8:03 UTC (permalink / raw)
  To: benh; +Cc: Joel Becker, Linux Netdev, Linux Kernel Mailing List,
	David S. Miller

Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:

> Bug is in the new dev_ifname32:
>
> 	uifr = compat_alloc_user_space(sizeof(struct ifreq));
> 	if (copy_in_user(uifr, compat_ptr(arg), sizeof(struct ifreq32)));
> 		return -EFAULT;
>
> There's a stray ";" after the if statement, that was obviously not
> tested :-)

Grr sorry about that, and thanks for catching this.

Eric


> This fixes it here (tested):
> ----------------------------------------------------------------------------
> [PATCH] Fix new dev_ifname32 returning -EFAULT
>
> A stray semicolon slipped in the patch that updated dev_ifname32 to
> not be inline, causing it to always return -EFAULT. This fixes it.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>
> Index: linux-work/fs/compat_ioctl.c
> ===================================================================
> --- linux-work.orig/fs/compat_ioctl.c	2007-10-31 13:30:42.000000000 +1100
> +++ linux-work/fs/compat_ioctl.c	2007-10-31 13:30:46.000000000 +1100
> @@ -322,7 +322,7 @@ static int dev_ifname32(unsigned int fd,
>  	int err;
>  
>  	uifr = compat_alloc_user_space(sizeof(struct ifreq));
> -	if (copy_in_user(uifr, compat_ptr(arg), sizeof(struct ifreq32)));
> +	if (copy_in_user(uifr, compat_ptr(arg), sizeof(struct ifreq32)))
>  		return -EFAULT;
>  
>  	err = sys_ioctl(fd, SIOCGIFNAME, (unsigned long)uifr);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-10-31  8:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20071031003850.GE7517@tasint.org>
2007-10-31  2:35 ` dev_ifname32() fails on 32->64bit calls in copy_in_user() Benjamin Herrenschmidt
2007-10-31  3:41   ` David Miller
2007-10-31  8:03   ` Eric W. Biederman

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).