Commit c03d01f3 authored by David Sterba's avatar David Sterba

btrfs: send: use vmalloc only as fallback for clone_roots

Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent e55d1153
...@@ -6053,10 +6053,13 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_) ...@@ -6053,10 +6053,13 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
alloc_size = sizeof(struct clone_root) * (arg->clone_sources_count + 1); alloc_size = sizeof(struct clone_root) * (arg->clone_sources_count + 1);
sctx->clone_roots = vzalloc(alloc_size); sctx->clone_roots = kzalloc(alloc_size, GFP_KERNEL | __GFP_NOWARN);
if (!sctx->clone_roots) { if (!sctx->clone_roots) {
ret = -ENOMEM; sctx->clone_roots = vzalloc(alloc_size);
goto out; if (!sctx->clone_roots) {
ret = -ENOMEM;
goto out;
}
} }
alloc_size = arg->clone_sources_count * sizeof(*arg->clone_sources); alloc_size = arg->clone_sources_count * sizeof(*arg->clone_sources);
...@@ -6227,7 +6230,7 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_) ...@@ -6227,7 +6230,7 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
if (sctx->send_filp) if (sctx->send_filp)
fput(sctx->send_filp); fput(sctx->send_filp);
vfree(sctx->clone_roots); kvfree(sctx->clone_roots);
kvfree(sctx->send_buf); kvfree(sctx->send_buf);
kvfree(sctx->read_buf); kvfree(sctx->read_buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment