]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mtd: fix oops in dataflash driver
authorWill Newton <will.newton@gmail.com>
Fri, 30 Mar 2012 10:51:02 +0000 (11:51 +0100)
committerArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Fri, 27 Apr 2012 06:02:18 +0000 (09:02 +0300)
commit16600bd9725dddbbee7ee212cbd2c7aeffe451af
treec0f372e0cdf8e5b88f4de00c186d203a2d217a92
parent23c0dd7b3dae5fa787f192ff05df0e5798d07b12
mtd: fix oops in dataflash driver

I'm seeing an oops in mtd_dataflash.c with Linux 3.3. What appears to
be happening is that otp_select_filemode calls mtd_read_fact_prot_reg
with -1 for offset and length and a NULL buffer to test if OTP
operations are supported. This finds its way down to otp_read in
mtd_dataflash.c and causes an oops when memcpying the returned data
into the NULL buf.

None of the checks in otp_read catches the negative length and offset.
Changing the length of the dummy read to 0 prevents the oops.

Cc: stable@krnel.org [3.3+]
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
drivers/mtd/mtdchar.c