diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 23:57:19 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 23:57:19 +0100 |
commit | 5c395ae7033099fc657114ea997858aa622f08b2 (patch) | |
tree | f714c8d8db528274de2da4f8aa64b69af0d2aa5e /fs/ubifs/xattr.c | |
parent | Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tei... (diff) | |
parent | UBI: fix use-after-free on error path (diff) | |
download | linux-5c395ae7033099fc657114ea997858aa622f08b2.tar.xz linux-5c395ae7033099fc657114ea997858aa622f08b2.zip |
Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6
* 'linux-next' of git://git.infradead.org/ubifs-2.6:
UBI: fix use-after-free on error path
UBI: fix missing scrub when there is a bit-flip
UBIFS: Use kmemdup rather than duplicating its implementation
Diffstat (limited to 'fs/ubifs/xattr.c')
-rw-r--r-- | fs/ubifs/xattr.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index bf18f7a04544..85b272268754 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c @@ -138,12 +138,11 @@ static int create_xattr(struct ubifs_info *c, struct inode *host, ui = ubifs_inode(inode); ui->xattr = 1; ui->flags |= UBIFS_XATTR_FL; - ui->data = kmalloc(size, GFP_NOFS); + ui->data = kmemdup(value, size, GFP_NOFS); if (!ui->data) { err = -ENOMEM; goto out_free; } - memcpy(ui->data, value, size); inode->i_size = ui->ui_size = size; ui->data_len = size; @@ -204,12 +203,11 @@ static int change_xattr(struct ubifs_info *c, struct inode *host, return err; kfree(ui->data); - ui->data = kmalloc(size, GFP_NOFS); + ui->data = kmemdup(value, size, GFP_NOFS); if (!ui->data) { err = -ENOMEM; goto out_free; } - memcpy(ui->data, value, size); inode->i_size = ui->ui_size = size; ui->data_len = size; |