aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.c
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@gmail.com>2013-08-13 22:00:20 -0400
committerChris Mason <chris.mason@fusionio.com>2013-09-01 08:15:48 -0400
commita696cf3529cecd261d6534fec242e39177b57e19 (patch)
tree8412607e4a543b58728ffd621af9a4a200f7918d /fs/btrfs/ioctl.c
parentb006b2e4f96a21958164ebf37e53c555d9e4fb2f (diff)
Btrfs: add missing error code to BTRFS_IOC_INO_LOOKUP handler
If the path doesn't fit in the input buffer, return ENAMETOOLONG instead of returning with a success code (0) and a partially filled and right justified buffer. Also removed useless buffer pointer check outside the while loop. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 317a984fe3c9..f88eeea365f3 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2030,8 +2030,10 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info,
2030 len = btrfs_inode_ref_name_len(l, iref); 2030 len = btrfs_inode_ref_name_len(l, iref);
2031 ptr -= len + 1; 2031 ptr -= len + 1;
2032 total_len += len + 1; 2032 total_len += len + 1;
2033 if (ptr < name) 2033 if (ptr < name) {
2034 ret = -ENAMETOOLONG;
2034 goto out; 2035 goto out;
2036 }
2035 2037
2036 *(ptr + len) = '/'; 2038 *(ptr + len) = '/';
2037 read_extent_buffer(l, ptr,(unsigned long)(iref + 1), len); 2039 read_extent_buffer(l, ptr,(unsigned long)(iref + 1), len);
@@ -2044,8 +2046,6 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info,
2044 key.offset = (u64)-1; 2046 key.offset = (u64)-1;
2045 dirid = key.objectid; 2047 dirid = key.objectid;
2046 } 2048 }
2047 if (ptr < name)
2048 goto out;
2049 memmove(name, ptr, total_len); 2049 memmove(name, ptr, total_len);
2050 name[total_len]='\0'; 2050 name[total_len]='\0';
2051 ret = 0; 2051 ret = 0;