diff options
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 2845c6ceecd2..e84ef60ffe35 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/security.h> | 39 | #include <linux/security.h> |
40 | #include <linux/xattr.h> | 40 | #include <linux/xattr.h> |
41 | #include <linux/vmalloc.h> | 41 | #include <linux/vmalloc.h> |
42 | #include <linux/slab.h> | ||
42 | #include "compat.h" | 43 | #include "compat.h" |
43 | #include "ctree.h" | 44 | #include "ctree.h" |
44 | #include "disk-io.h" | 45 | #include "disk-io.h" |
@@ -48,7 +49,6 @@ | |||
48 | #include "print-tree.h" | 49 | #include "print-tree.h" |
49 | #include "volumes.h" | 50 | #include "volumes.h" |
50 | #include "locking.h" | 51 | #include "locking.h" |
51 | #include "ctree.h" | ||
52 | 52 | ||
53 | /* Mask out flags that are inappropriate for the given type of inode. */ | 53 | /* Mask out flags that are inappropriate for the given type of inode. */ |
54 | static inline __u32 btrfs_mask_flags(umode_t mode, __u32 flags) | 54 | static inline __u32 btrfs_mask_flags(umode_t mode, __u32 flags) |
@@ -511,7 +511,7 @@ static int should_defrag_range(struct inode *inode, u64 start, u64 len, | |||
511 | em = btrfs_get_extent(inode, NULL, 0, start, len, 0); | 511 | em = btrfs_get_extent(inode, NULL, 0, start, len, 0); |
512 | unlock_extent(io_tree, start, start + len - 1, GFP_NOFS); | 512 | unlock_extent(io_tree, start, start + len - 1, GFP_NOFS); |
513 | 513 | ||
514 | if (!em) | 514 | if (IS_ERR(em)) |
515 | return 0; | 515 | return 0; |
516 | } | 516 | } |
517 | 517 | ||
@@ -1212,6 +1212,9 @@ static noinline int btrfs_ioctl_ino_lookup(struct file *file, | |||
1212 | return -EPERM; | 1212 | return -EPERM; |
1213 | 1213 | ||
1214 | args = kmalloc(sizeof(*args), GFP_KERNEL); | 1214 | args = kmalloc(sizeof(*args), GFP_KERNEL); |
1215 | if (!args) | ||
1216 | return -ENOMEM; | ||
1217 | |||
1215 | if (copy_from_user(args, argp, sizeof(*args))) { | 1218 | if (copy_from_user(args, argp, sizeof(*args))) { |
1216 | kfree(args); | 1219 | kfree(args); |
1217 | return -EFAULT; | 1220 | return -EFAULT; |
@@ -1375,6 +1378,7 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp) | |||
1375 | sizeof(*range))) { | 1378 | sizeof(*range))) { |
1376 | ret = -EFAULT; | 1379 | ret = -EFAULT; |
1377 | kfree(range); | 1380 | kfree(range); |
1381 | goto out; | ||
1378 | } | 1382 | } |
1379 | /* compression requires us to start the IO */ | 1383 | /* compression requires us to start the IO */ |
1380 | if ((range->flags & BTRFS_DEFRAG_RANGE_COMPRESS)) { | 1384 | if ((range->flags & BTRFS_DEFRAG_RANGE_COMPRESS)) { |