summaryrefslogtreecommitdiffstats
path: root/fs/xattr.c
diff options
context:
space:
mode:
authorDaniel Xu <dxu@dxuuu.xyz>2020-03-12 21:03:14 +0100
committerTejun Heo <tj@kernel.org>2020-03-16 20:53:47 +0100
commitfdc85222d58eb6e19ac11181024ac766b19dc470 (patch)
treef9ea506b4f94759dd3ceab39e8a3d25ed6689891 /fs/xattr.c
parentcgroup: Restructure release_agent_path handling (diff)
downloadlinux-fdc85222d58eb6e19ac11181024ac766b19dc470.tar.xz
linux-fdc85222d58eb6e19ac11181024ac766b19dc470.zip
kernfs: kvmalloc xattr value instead of kmalloc
xattr values have a 64k maximum size. This can result in an order 4 kmalloc request which can be difficult to fulfill. Since xattrs do not need physically contiguous memory, we can switch to kvmalloc and not have to worry about higher order allocations failing. Signed-off-by: Daniel Xu <dxu@dxuuu.xyz> Acked-by: Chris Down <chris@chrisdown.name> Reviewed-by: Andreas Dilger <adilger@dilger.ca> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'fs/xattr.c')
-rw-r--r--fs/xattr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/xattr.c b/fs/xattr.c
index 90dd78f0eb27..0d3c9b4d1914 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -817,7 +817,7 @@ struct simple_xattr *simple_xattr_alloc(const void *value, size_t size)
if (len < sizeof(*new_xattr))
return NULL;
- new_xattr = kmalloc(len, GFP_KERNEL);
+ new_xattr = kvmalloc(len, GFP_KERNEL);
if (!new_xattr)
return NULL;
@@ -882,7 +882,7 @@ int simple_xattr_set(struct simple_xattrs *xattrs, const char *name,
new_xattr->name = kstrdup(name, GFP_KERNEL);
if (!new_xattr->name) {
- kfree(new_xattr);
+ kvfree(new_xattr);
return -ENOMEM;
}
}
@@ -912,7 +912,7 @@ out:
spin_unlock(&xattrs->lock);
if (xattr) {
kfree(xattr->name);
- kfree(xattr);
+ kvfree(xattr);
}
return err;