From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Aneesh Kumar K. V" Subject: Re: [RFC PATCH 1/3] vfs: Add name to file handle conversion support Date: Mon, 22 Feb 2010 10:45:37 +0530 Message-ID: <87vddpn952.fsf@linux.vnet.ibm.com> References: <1266558149-11460-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1266558149-11460-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <3E089F64-DC5C-43EA-8A98-B6CB40EB669F@sun.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: hch@infradead.org, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org To: Andreas Dilger Return-path: Received: from e28smtp06.in.ibm.com ([122.248.162.6]:54337 "EHLO e28smtp06.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751093Ab0BVFPl (ORCPT ); Mon, 22 Feb 2010 00:15:41 -0500 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by e28smtp06.in.ibm.com (8.14.3/8.13.1) with ESMTP id o1M5FduD025537 for ; Mon, 22 Feb 2010 10:45:39 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o1M5Fd9h2904190 for ; Mon, 22 Feb 2010 10:45:39 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o1M5FcAh019451 for ; Mon, 22 Feb 2010 16:15:39 +1100 In-Reply-To: <3E089F64-DC5C-43EA-8A98-B6CB40EB669F@sun.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sat, 20 Feb 2010 11:15:33 -0700, Andreas Dilger wrote: > On 2010-02-18, at 22:42, Aneesh Kumar K.V wrote: > > +static int do_sys_name_to_handle(const char __user *name, > > + struct file_handle *handle) > > +{ > > + /* we ask for a non connected handle */ > > + retval = exportfs_encode_fh(path.dentry, (struct fid *)f_handle, > > + &handle_size, 0); > > + if (handle_size < handle->handle_size) { > > + if (copy_to_user(handle->f_handle, f_handle, > > + handle_size*sizeof(u32))) > > + retval = -EFAULT; > > Shouldn't this be "handle_size <= handle->handle_size"? Yes. Will fix in the next iteration. > > > +SYSCALL_DEFINE2(name_to_handle, const char __user *, name, > > + struct file_handle __user *, handle) > > +{ > > + ret = do_sys_name_to_handle(name, &f_handle); > > + if (copy_to_user(&handle->handle_type, > > + &f_handle.handle_type, sizeof(f_handle.handle_type)) || > > + copy_to_user(&handle->handle_size, > > + &f_handle.handle_size, sizeof(f_handle.handle_size))) > > It seems strange to do the copy_to_user() of f_handle in > do_sys_name_to_handle(), but the handle_size and handle_type in > name_to_handle()? Is there a reason it was split this way? > No specific reason. -aneesh