Re: [RFC PATCH 1/3] vfs: Add name to file handle conversion support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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"?

+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?

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux