Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 298647
b: refs/heads/master
c: 0d08d7b
h: refs/heads/master
i:
  298645: cc1a91c
  298643: 54aaad6
  298639: 353c754
v: v3
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Apr 5, 2012
1 parent d997d1b commit d32d99b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 703bf2d122c95412a30f72658c53ad6292867b0b
refs/heads/master: 0d08d7b7e13b5060181b11ecdde82d8fda322123
17 changes: 13 additions & 4 deletions trunk/fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#include <linux/export.h>
#include <linux/fsnotify.h>
#include <linux/audit.h>
#include <asm/uaccess.h>
#include <linux/vmalloc.h>

#include <asm/uaccess.h>

/*
* Check permissions for extended attribute access. This is a bit complicated
Expand Down Expand Up @@ -492,13 +493,18 @@ listxattr(struct dentry *d, char __user *list, size_t size)
{
ssize_t error;
char *klist = NULL;
char *vlist = NULL; /* If non-NULL, we used vmalloc() */

if (size) {
if (size > XATTR_LIST_MAX)
size = XATTR_LIST_MAX;
klist = kmalloc(size, __GFP_NOWARN | GFP_KERNEL);
if (!klist)
return -ENOMEM;
if (!klist) {
vlist = vmalloc(size);
if (!vlist)
return -ENOMEM;
klist = vlist;
}
}

error = vfs_listxattr(d, klist, size);
Expand All @@ -510,7 +516,10 @@ listxattr(struct dentry *d, char __user *list, size_t size)
than XATTR_LIST_MAX bytes. Not possible. */
error = -E2BIG;
}
kfree(klist);
if (vlist)
vfree(vlist);
else
kfree(klist);
return error;
}

Expand Down

0 comments on commit d32d99b

Please sign in to comment.