android_kernel_motorola_sm6225/drivers/mtd
Artem Bityutskiy 154bf89f5e mtd: mtdpart: disallow reading OOB past the end of the partition
This patch fixes the mtdpart bug which allows users reading OOB past the
end of the partition. This happens because 'part_read_oob()' allows reading
multiple OOB areas in one go, and mtdparts does not validate the OOB
length in the request.

Although there is such check in 'nand_do_read_oob()' in nand_base.c, but
it checks that we do not read past the flash chip, not the partition,
because in nand_base.c we work with the whole chip (e.g., mtd->size
in nand_base.c is the size of the whole chip). So this check cannot
be done correctly in nand_base.c and should be instead done in mtdparts.c.

This problem was reported by Jason Liu <r64343@freescale.com> and reproduced
with nandsim:

$ modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 \
                   fourth_id_byte=0x15 parts=0x400,0x400
$ modprobe nandsim mtd_oobtest.ko dev=0
$ dmesg
= snip =
mtd_oobtest: attempting to read past end of device
mtd_oobtest: an error is expected...
mtd_oobtest: error: read past end of device
= snip =
mtd_oobtest: finished with 2 errors

Reported-by: Jason Liu <liu.h.jason@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2011-01-17 15:25:48 +00:00
..
chips mtd: cfi: add writebufsize initialization 2011-01-06 15:35:53 +00:00
devices mtd: m25p80: Fix JEDEC ID for AT26DF321 2011-01-06 15:34:02 +00:00
lpddr mtd: change struct flchip_shared spinlock locking into mutex 2010-08-06 09:22:16 +01:00
maps mtd: maps: Use printf extension %pR for struct resource 2010-12-03 16:29:54 +00:00
nand mtd: pxa3xx_nand: NULL dereference in pxa3xx_nand_probe 2011-01-06 15:48:59 +00:00
onenand mtd: onenand: add mtd->writebufsize initialization 2011-01-06 15:35:57 +00:00
tests mtd: tests: return -1 if verify failed 2010-08-02 09:06:20 +01:00
ubi UBI: use mtd->writebufsize to set minimal I/O unit size 2011-01-06 15:36:00 +00:00
afs.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
ar7part.c [MTD] mtdpart: Make all partition parsers return allocated array 2009-03-20 18:55:17 +00:00
cmdlinepart.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
ftl.c Update broken web addresses in the kernel. 2010-10-18 11:03:14 +02:00
inftlcore.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
inftlmount.c mtd: Remove obsolete <mtd/compatmac.h> include 2010-08-08 21:19:42 +01:00
Kconfig mtd: Fix MTD_OF_PARTS for all arch and minor tidy of MTD_PARTITIONS 2010-12-03 16:25:56 +00:00
Makefile mtd: Fix MTD_OF_PARTS for all arch and minor tidy of MTD_PARTITIONS 2010-12-03 16:25:56 +00:00
mtd_blkdevs.c mtd: Remove redundant mutex from mtd_blkdevs.c 2010-10-30 12:39:21 +01:00
mtdblock.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
mtdblock_ro.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
mtdchar.c mtd: fix master device identification for mtd repartition 2010-12-03 16:32:35 +00:00
mtdconcat.c mtd: initialize writebufsize in the MTD object of a partition 2011-01-06 15:35:58 +00:00
mtdcore.c mtd: Remove obsolete <mtd/compatmac.h> include 2010-08-08 21:19:42 +01:00
mtdcore.h mtd: Replace static array of devices with an idr structure 2010-02-25 11:55:14 +00:00
mtdoops.c mtd: don't use flush_scheduled_work() 2011-01-06 15:17:08 +00:00
mtdpart.c mtd: mtdpart: disallow reading OOB past the end of the partition 2011-01-17 15:25:48 +00:00
mtdsuper.c convert get_sb_mtd() users to ->mount() 2010-10-29 04:16:26 -04:00
nftlcore.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
nftlmount.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
ofpart.c mtd: Fix endianness issues from device tree 2010-10-25 00:55:56 +01:00
redboot.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
rfd_ftl.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
sm_ftl.c bitops: rename for_each_bit() to for_each_set_bit(): mtd 2010-04-08 09:42:41 +01:00
sm_ftl.h mtd: sm_ftl: cosmetic, use bool when possible 2010-10-25 01:33:08 +01:00
ssfdc.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00