Signed-off-by: David Sterba <dsterba@xxxxxxxx>
---
fs/btrfs/send.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 19b7bf4284ee..8f6f9d6d14df 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -6022,10 +6022,13 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
sctx->clone_roots_cnt = arg->clone_sources_count;
sctx->send_max_size = BTRFS_SEND_BUF_SIZE;
- sctx->send_buf = vmalloc(sctx->send_max_size);
+ sctx->send_buf = kmalloc(sctx->send_max_size, GFP_KERNEL | __GFP_NOWARN);
if (!sctx->send_buf) {
- ret = -ENOMEM;
- goto out;
+ sctx->send_buf = vmalloc(sctx->send_max_size);
+ if (!sctx->send_buf) {
+ ret = -ENOMEM;
+ goto out;
+ }
}
sctx->read_buf = vmalloc(BTRFS_SEND_READ_SIZE);
@@ -6214,7 +6217,7 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
fput(sctx->send_filp);
vfree(sctx->clone_roots);
- vfree(sctx->send_buf);
+ kvfree(sctx->send_buf);
vfree(sctx->read_buf);
name_cache_free(sctx);
--
2.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html