Skip to contentSkip to conversation

Btrfs: fix error handling in btrfs_ioctl_send()

PATCH New Tsutomu Itoh 1 participant 1 message Apr 19, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: fix error handling in btrfs_ioctl_send()

fget() returns NULL if error. So, we should check NULL or not.

---
 fs/btrfs/send.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/send.c +2 -2
index 96a826a..f892e0e 100644
@@ -4610,8 +4610,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;
 	}