diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index edf5f0093f22292199cb828b40ffa321bafef1b5..ed3edc2832554b429c460428a1e57656d2822481 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1474,6 +1474,10 @@ static noinline int btrfs_ioctl_resize(struct file *file,
 		}
 		new_size = old_size - new_size;
 	} else if (mod > 0) {
+		if (new_size > ULLONG_MAX - old_size) {
+			ret = -EINVAL;
+			goto out_free;
+		}
 		new_size = old_size + new_size;
 	}