From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Herrenschmidt Subject: Re: dev_ifname32() fails on 32->64bit calls in copy_in_user(). Date: Wed, 31 Oct 2007 13:35:24 +1100 Message-ID: <1193798124.9928.91.camel@pasglop> References: <20071031003850.GE7517@tasint.org> Reply-To: benh@kernel.crashing.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Linux Netdev , Linux Kernel Mailing List , "Eric W. Biederman" , "David S. Miller" To: Joel Becker Return-path: Received: from gate.crashing.org ([63.228.1.57]:53003 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751928AbXJaCfm (ORCPT ); Tue, 30 Oct 2007 22:35:42 -0400 In-Reply-To: <20071031003850.GE7517@tasint.org> Sender: netdev-owner@vger.kernel.org List-Id: netdev.vger.kernel.org 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 --- 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);