From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [patch] fcntl: return -EFAULT if copy_to_user fails Date: Thu, 3 Jun 2010 13:45:44 +0100 Message-ID: <20100603124544.GX31073@ZenIV.linux.org.uk> References: <20100603100402.GR5483@bicker> <4C07826A.6060302@oss.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Dan Carpenter , Matthew Wilcox , Andrew Morton , Oleg Nesterov , Jens Axboe , Greg Kroah-Hartman , Peter Zijlstra , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Takuya Yoshikawa Return-path: Content-Disposition: inline In-Reply-To: <4C07826A.6060302@oss.ntt.co.jp> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Thu, Jun 03, 2010 at 07:22:34PM +0900, Takuya Yoshikawa wrote: > (2010/06/03 19:04), Dan Carpenter wrote: > >copy_to_user() returns the number of bytes remaining, but we want to > >return -EFAULT. > > > > ret = fcntl(fd, F_SETOWN_EX, NULL); > > > >With the original code ret would be 8 here. > > > >Signed-off-by: Dan Carpenter > > How about f_getown_ex() ? > > if (!ret) > ret = copy_to_user(owner_p, &owner, sizeof(owner)); > return ret; > > Fixing this too would be better, I think. > > Takuya Applied, will push today.