<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/mtd, branch v3.4.105</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v3.4.105</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v3.4.105'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2014-07-09T17:51:20+00:00</updated>
<entry>
<title>mtd: pxa3xx_nand: make the driver work on big-endian systems</title>
<updated>2014-07-09T17:51:20+00:00</updated>
<author>
<name>Thomas Petazzoni</name>
<email>thomas.petazzoni@free-electrons.com</email>
</author>
<published>2014-05-22T12:56:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c27517de002506599c8eeb75ad4d1fa5f9204496'/>
<id>urn:sha1:c27517de002506599c8eeb75ad4d1fa5f9204496</id>
<content type='text'>
commit b7e460624f0f3c31150f3b09e75b0d009e22ba5f upstream.

The pxa3xx_nand driver currently uses __raw_writel() and __raw_readl()
to access I/O registers. However, those functions do not do any
endianness swapping, which means that they won't work when the CPU
runs in big-endian but the I/O registers are little endian, which is
the common situation for ARM systems running big endian.

Since __raw_writel() and __raw_readl() do not include any memory
barriers and the pxa3xx_nand driver can only be compiled for ARM
platforms, the closest I/o accessors functions that do endianess
swapping are writel_relaxed() and readl_relaxed().

This patch has been verified to work on Armada XP GP: without the
patch, the NAND is not detected when the kernel runs big endian while
it is properly detected when the kernel runs little endian. With the
patch applied, the NAND is properly detected in both situations
(little and big endian).

Signed-off-by: Thomas Petazzoni &lt;thomas.petazzoni@free-electrons.com&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>mtd: m25p80: fix allocation size</title>
<updated>2014-06-07T23:02:15+00:00</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2013-07-25T01:32:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c341968e1a44810713ade43ca8b0f5dd802a1ce9'/>
<id>urn:sha1:c341968e1a44810713ade43ca8b0f5dd802a1ce9</id>
<content type='text'>
commit 778d226a1462572b51d6777cdb1d611543410cb4 upstream.

This patch fixes two memory errors:

1. During a probe failure (in mtd_device_parse_register?) the command
   buffer would not be freed.

2. The command buffer's size is determined based on the 'fast_read'
   boolean, but the assignment of fast_read is made after this
   allocation. Thus, the buffer may be allocated "too small".

To fix the first, just switch to the devres version of kzalloc.

To fix the second, increase MAX_CMD_SIZE unconditionally. It's not worth
saving a byte to fiddle around with the conditions here.

This problem was reported by Yuhang Wang a while back.

Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Reported-by: Yuhang Wang &lt;wangyuhang2014@gmail.com&gt;
Reviewed-by: Sourav Poddar &lt;sourav.poddar@ti.com&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: Qiang Huang &lt;h.huangqiang@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>UBI: erase free PEB with bitflip in EC header</title>
<updated>2014-06-07T23:02:06+00:00</updated>
<author>
<name>Matthieu CASTET</name>
<email>matthieu.castet@parrot.com</email>
</author>
<published>2012-08-22T14:03:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b2d995371398e957f9bde58786b719162434f0aa'/>
<id>urn:sha1:b2d995371398e957f9bde58786b719162434f0aa</id>
<content type='text'>
commit 193819cf2e6e395b1e1be2d36785dc5563a6edca upstream.

Without this patch, these PEB are not scrubbed until we put data in them.
Bitflip can accumulate latter and we can loose the EC header (but VID header
should be intact and allow to recover data).

Signed-off-by: Matthieu Castet &lt;matthieu.castet@parrot.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
[bwh: Backported to 3.2: adjust filename, context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: Qiang Huang &lt;h.huangqiang@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>mtd: sm_ftl: heap corruption in sm_create_sysfs_attributes()</title>
<updated>2014-05-13T12:11:32+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2013-12-05T14:53:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9a9269138723e71e87f4adb00c0c2bbdc7bdcd0b'/>
<id>urn:sha1:9a9269138723e71e87f4adb00c0c2bbdc7bdcd0b</id>
<content type='text'>
commit b4c233057771581698a13694ab6f33b48ce837dc upstream.

We always put a NUL terminator one space past the end of the "vendor"
buffer.  Walter Harms also pointed out that this should just use
kstrndup().

Fixes: 7d17c02a01a1 ('mtd: Add new SmartMedia/xD FTL')

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>mtd: nuc900_nand: NULL dereference in nuc900_nand_enable()</title>
<updated>2014-05-13T12:11:31+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2014-02-17T20:03:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c3a47361053bdd9059eec78510de21684f4112c5'/>
<id>urn:sha1:c3a47361053bdd9059eec78510de21684f4112c5</id>
<content type='text'>
commit c69dbbf3335a21aae74376d7e5db50a486d52439 upstream.

Instead of writing to "nand-&gt;reg + REG_FMICSR" we write to "REG_FMICSR"
which is NULL and not a valid register.

Fixes: 8bff82cbc308 ('mtd: add nand support for w90p910 (v2)')
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>mtd: mxc_nand: remove duplicated ecc_stats counting</title>
<updated>2014-02-13T19:51:10+00:00</updated>
<author>
<name>Michael Grzeschik</name>
<email>m.grzeschik@pengutronix.de</email>
</author>
<published>2013-11-29T13:14:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0b909374b96f4ac56fcb18f3a94ff5c359ab46fa'/>
<id>urn:sha1:0b909374b96f4ac56fcb18f3a94ff5c359ab46fa</id>
<content type='text'>
commit 0566477762f9e174e97af347ee9c865f908a5647 upstream.

The ecc_stats.corrected count variable will already be incremented in
the above framework-layer just after this callback.

Signed-off-by: Michael Grzeschik &lt;m.grzeschik@pengutronix.de&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>mtd: gpmi: fix kernel BUG due to racing DMA operations</title>
<updated>2013-12-04T18:50:29+00:00</updated>
<author>
<name>Huang Shijie</name>
<email>b32955@freescale.com</email>
</author>
<published>2013-11-11T04:13:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1eb9c3425abb5a187ef7b52206eb395aa896151e'/>
<id>urn:sha1:1eb9c3425abb5a187ef7b52206eb395aa896151e</id>
<content type='text'>
commit 7b3d2fb92067bcb29f0f085a9fa9fa64920a6646 upstream.

[1] The gpmi uses the nand_command_lp to issue the commands to NAND chips.
    The gpmi issues a DMA operation with gpmi_cmd_ctrl when it handles
    a NAND_CMD_NONE control command. So when we read a page(NAND_CMD_READ0)
    from the NAND, we may send two DMA operations back-to-back.

    If we do not serialize the two DMA operations, we will meet a bug when

    1.1) we enable CONFIG_DMA_API_DEBUG, CONFIG_DMADEVICES_DEBUG,
         and CONFIG_DEBUG_SG.

    1.2) Use the following commands in an UART console and a SSH console:
         cmd 1: while true;do dd if=/dev/mtd0 of=/dev/null;done
         cmd 1: while true;do dd if=/dev/mmcblk0 of=/dev/null;done

    The kernel log shows below:
    -----------------------------------------------------------------
    kernel BUG at lib/scatterlist.c:28!
    Unable to handle kernel NULL pointer dereference at virtual address 00000000
      .........................
    [&lt;80044a0c&gt;] (__bug+0x18/0x24) from [&lt;80249b74&gt;] (sg_next+0x48/0x4c)
    [&lt;80249b74&gt;] (sg_next+0x48/0x4c) from [&lt;80255398&gt;] (debug_dma_unmap_sg+0x170/0x1a4)
    [&lt;80255398&gt;] (debug_dma_unmap_sg+0x170/0x1a4) from [&lt;8004af58&gt;] (dma_unmap_sg+0x14/0x6c)
    [&lt;8004af58&gt;] (dma_unmap_sg+0x14/0x6c) from [&lt;8027e594&gt;] (mxs_dma_tasklet+0x18/0x1c)
    [&lt;8027e594&gt;] (mxs_dma_tasklet+0x18/0x1c) from [&lt;8007d444&gt;] (tasklet_action+0x114/0x164)
    -----------------------------------------------------------------

    1.3) Assume the two DMA operations is X (first) and Y (second).

         The root cause of the bug:
	   Assume process P issues DMA X, and sleep on the completion
	 @this-&gt;dma_done. X's tasklet callback is dma_irq_callback. It firstly
	 wake up the process sleeping on the completion @this-&gt;dma_done,
	 and then trid to unmap the scatterlist S. The waked process P will
	 issue Y in another ARM core. Y initializes S-&gt;sg_magic to zero
	 with sg_init_one(), while dma_irq_callback is unmapping S at the same
	 time.

	 See the diagram:

                   ARM core 0              |         ARM core 1
	 -------------------------------------------------------------
         (P issues DMA X, then sleep)  --&gt; |
                                           |
         (X's tasklet wakes P)         --&gt; |
                                           |
                                           | &lt;-- (P begin to issue DMA Y)
                                           |
         (X's tasklet unmap the            |
      scatterlist S with dma_unmap_sg) --&gt; | &lt;-- (Y calls sg_init_one() to init
                                           |      scatterlist S)
                                           |

[2] This patch serialize both the X and Y in the following way:
     Unmap the DMA scatterlist S firstly, and wake up the process at the end
     of the DMA callback, in such a way, Y will be executed after X.

     After this patch:

                   ARM core 0              |         ARM core 1
	 -------------------------------------------------------------
         (P issues DMA X, then sleep)  --&gt; |
                                           |
         (X's tasklet unmap the            |
      scatterlist S with dma_unmap_sg) --&gt; |
                                           |
         (X's tasklet wakes P)         --&gt; |
                                           |
                                           | &lt;-- (P begin to issue DMA Y)
                                           |
                                           | &lt;-- (Y calls sg_init_one() to init
                                           |     scatterlist S)
                                           |

Signed-off-by: Huang Shijie &lt;b32955@freescale.com&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>mtd: nand: hack ONFI for non-power-of-2 dimensions</title>
<updated>2013-12-04T18:50:28+00:00</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2013-08-28T01:45:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b22831e6611bec1fdf84e71d80f7917199212ee8'/>
<id>urn:sha1:b22831e6611bec1fdf84e71d80f7917199212ee8</id>
<content type='text'>
commit 4355b70cf48363c50a9de450b01178c83aba8f6a upstream.

Some bright specification writers decided to write this in the ONFI spec
(from ONFI 3.0, Section 3.1):

  "The number of blocks and number of pages per block is not required to
  be a power of two. In the case where one of these values is not a
  power of two, the corresponding address shall be rounded to an
  integral number of bits such that it addresses a range up to the
  subsequent power of two value. The host shall not access upper
  addresses in a range that is shown as not supported."

This breaks every assumption MTD makes about NAND block/chip-size
dimensions -- they *must* be a power of two!

And of course, an enterprising manufacturer has made use of this lovely
freedom. Exhibit A: Micron MT29F32G08CBADAWP

  "- Plane size: 2 planes x 1064 blocks per plane
   - Device size: 32Gb: 2128 blockss [sic]"

This quickly hits a BUG() in nand_base.c, since the extra dimensions
overflow so we think it's a second chip (on my single-chip setup):

    ONFI param page 0 valid
    ONFI flash detected
    NAND device: Manufacturer ID: 0x2c, Chip ID: 0x44 (Micron MT29F32G08CBADAWP), 4256MiB, page size: 8192, OOB size: 744
    ------------[ cut here ]------------
    kernel BUG at drivers/mtd/nand/nand_base.c:203!
    Internal error: Oops - BUG: 0 [#1] SMP ARM
    [... trim ...]
    [&lt;c02cf3e4&gt;] (nand_select_chip+0x18/0x2c) from [&lt;c02d25c0&gt;] (nand_do_read_ops+0x90/0x424)
    [&lt;c02d25c0&gt;] (nand_do_read_ops+0x90/0x424) from [&lt;c02d2dd8&gt;] (nand_read+0x54/0x78)
    [&lt;c02d2dd8&gt;] (nand_read+0x54/0x78) from [&lt;c02ad2c8&gt;] (mtd_read+0x84/0xbc)
    [&lt;c02ad2c8&gt;] (mtd_read+0x84/0xbc) from [&lt;c02d4b28&gt;] (scan_read.clone.4+0x4c/0x64)
    [&lt;c02d4b28&gt;] (scan_read.clone.4+0x4c/0x64) from [&lt;c02d4c88&gt;] (search_bbt+0x148/0x290)
    [&lt;c02d4c88&gt;] (search_bbt+0x148/0x290) from [&lt;c02d4ea4&gt;] (nand_scan_bbt+0xd4/0x5c0)
    [... trim ...]
    ---[ end trace 0c9363860d865ff2 ]---

So to fix this, just truncate these dimensions down to the greatest
power-of-2 dimension that is less than or equal to the specified
dimension.

Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>vm: convert mtdchar mmap to vm_iomap_memory() helper</title>
<updated>2013-04-26T04:19:56+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2013-04-19T16:53:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b00919cd72ed9753390a9fbb5541cbba12e5e826'/>
<id>urn:sha1:b00919cd72ed9753390a9fbb5541cbba12e5e826</id>
<content type='text'>
commit 8558e4a26b00225efeb085725bc319f91201b239 upstream.

This is my example conversion of a few existing mmap users.  The mtdchar
case is actually disabled right now (and stays disabled), but I did it
because it showed up on my "git grep", and I was familiar with the code
due to fixing an overflow problem in the code in commit 9c603e53d380
("mtdchar: fix offset overflow detection").

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>mtd: Disable mtdchar mmap on MMU systems</title>
<updated>2013-04-17T04:27:27+00:00</updated>
<author>
<name>David Woodhouse</name>
<email>David.Woodhouse@intel.com</email>
</author>
<published>2012-10-09T14:08:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=06ce3e44cb3152be067f7a637a08df8c577f4620'/>
<id>urn:sha1:06ce3e44cb3152be067f7a637a08df8c577f4620</id>
<content type='text'>
commit f5cf8f07423b2677cebebcebc863af77223a4972 upstream.

This code was broken because it assumed that all MTD devices were map-based.
Disable it for now, until it can be fixed properly for the next merge window.

Signed-off-by: David Woodhouse &lt;David.Woodhouse@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
