diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-06-07 20:10:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-06-07 20:10:06 -0400 |
commit | 3975d16760d4be7402d1067c548c30c427971331 (patch) | |
tree | 4fa12ee1e8aabf1352307455163dabe293ed4874 /drivers/mtd/mtdchar.c | |
parent | 4d3d769c605ebdf9fbb5a9d63827598b48351861 (diff) | |
parent | 1c24d06f8e065023ebb428db5af5514500839ee6 (diff) |
Merge git://git.infradead.org/~dwmw2/mtd-2.6.35
* git://git.infradead.org/~dwmw2/mtd-2.6.35:
jffs2: update ctime when changing the file's permission by setfacl
jffs2: Fix NFS race by using insert_inode_locked()
jffs2: Fix in-core inode leaks on error paths
mtd: Fix NAND submenu
mtd/r852: update card detect early.
mtd/r852: Fixes in case of DMA timeout
mtd/r852: register IRQ as last step
drivers/mtd: Use memdup_user
docbook: make mtd nand module init static
Diffstat (limited to 'drivers/mtd/mtdchar.c')
-rw-r--r-- | drivers/mtd/mtdchar.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 000d65ea55a4..91c8013cf0d9 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -404,14 +404,9 @@ static int mtd_do_writeoob(struct file *file, struct mtd_info *mtd, | |||
404 | if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs)) | 404 | if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs)) |
405 | return -EINVAL; | 405 | return -EINVAL; |
406 | 406 | ||
407 | ops.oobbuf = kmalloc(length, GFP_KERNEL); | 407 | ops.oobbuf = memdup_user(ptr, length); |
408 | if (!ops.oobbuf) | 408 | if (IS_ERR(ops.oobbuf)) |
409 | return -ENOMEM; | 409 | return PTR_ERR(ops.oobbuf); |
410 | |||
411 | if (copy_from_user(ops.oobbuf, ptr, length)) { | ||
412 | kfree(ops.oobbuf); | ||
413 | return -EFAULT; | ||
414 | } | ||
415 | 410 | ||
416 | start &= ~((uint64_t)mtd->oobsize - 1); | 411 | start &= ~((uint64_t)mtd->oobsize - 1); |
417 | ret = mtd->write_oob(mtd, start, &ops); | 412 | ret = mtd->write_oob(mtd, start, &ops); |