Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 319874
b: refs/heads/master
c: 779302e
h: refs/heads/master
v: v3
  • Loading branch information
Sasha Levin authored and Linus Torvalds committed Jul 31, 2012
1 parent fc7c92e commit 2fcbf95
Show file tree
Hide file tree
Showing 2 changed files with 13 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: 32b4560b04af6e4fee241ea6de6db780eaf354f2
refs/heads/master: 779302e67835fe9a6b74327e54969ba59cb3478a
16 changes: 12 additions & 4 deletions trunk/fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ getxattr(struct dentry *d, const char __user *name, void __user *value,
{
ssize_t error;
void *kvalue = NULL;
void *vvalue = NULL;
char kname[XATTR_NAME_MAX + 1];

error = strncpy_from_user(kname, name, sizeof(kname));
Expand All @@ -438,9 +439,13 @@ getxattr(struct dentry *d, const char __user *name, void __user *value,
if (size) {
if (size > XATTR_SIZE_MAX)
size = XATTR_SIZE_MAX;
kvalue = kzalloc(size, GFP_KERNEL);
if (!kvalue)
return -ENOMEM;
kvalue = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
if (!kvalue) {
vvalue = vmalloc(size);
if (!vvalue)
return -ENOMEM;
kvalue = vvalue;
}
}

error = vfs_getxattr(d, kname, kvalue, size);
Expand All @@ -452,7 +457,10 @@ getxattr(struct dentry *d, const char __user *name, void __user *value,
than XATTR_SIZE_MAX bytes. Not possible. */
error = -E2BIG;
}
kfree(kvalue);
if (vvalue)
vfree(vvalue);
else
kfree(kvalue);
return error;
}

Expand Down

0 comments on commit 2fcbf95

Please sign in to comment.