Btrfs: fix error handling in btrfs_ioctl_send()
authorTsutomu Itoh <[email protected]>
Fri, 19 Apr 2013 01:04:46 +0000 (01:04 +0000)
committerJosef Bacik <[email protected]>
Mon, 6 May 2013 19:55:13 +0000 (15:55 -0400)
fget() returns NULL if error. So, we should check NULL or not.

Signed-off-by: Tsutomu Itoh <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
fs/btrfs/send.c

index 158b91984b600099cd1938649393ef0a969c2db2..2037fc0efab168235c3a4b596d1e6ec1e8eacb59 100644 (file)
@@ -4612,8 +4612,8 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
        sctx->flags = arg->flags;
 
        sctx->send_filp = fget(arg->send_fd);
-       if (IS_ERR(sctx->send_filp)) {
-               ret = PTR_ERR(sctx->send_filp);
+       if (!sctx->send_filp) {
+               ret = -EBADF;
                goto out;
        }