<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/mtd, branch v4.9.96</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>ubi: Reject MLC NAND</title>
<updated>2018-04-24T07:34:09+00:00</updated>
<author>
<name>Richard Weinberger</name>
<email>richard@nod.at</email>
</author>
<published>2018-03-03T10:45:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c64c4c81aed52fc84be225ce47863a41eb4f7bb6'/>
<id>c64c4c81aed52fc84be225ce47863a41eb4f7bb6</id>
<content type='text'>
commit b5094b7f135be34630e3ea8a98fa215715d0f29d upstream.

While UBI and UBIFS seem to work at first sight with MLC NAND, you will
most likely lose all your data upon a power-cut or due to read/write
disturb.
In order to protect users from bad surprises, refuse to attach to MLC
NAND.

Cc: stable@vger.kernel.org
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Acked-by: Boris Brezillon &lt;boris.brezillon@bootlin.com&gt;
Acked-by: Artem Bityutskiy &lt;dedekind1@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit b5094b7f135be34630e3ea8a98fa215715d0f29d upstream.

While UBI and UBIFS seem to work at first sight with MLC NAND, you will
most likely lose all your data upon a power-cut or due to read/write
disturb.
In order to protect users from bad surprises, refuse to attach to MLC
NAND.

Cc: stable@vger.kernel.org
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Acked-by: Boris Brezillon &lt;boris.brezillon@bootlin.com&gt;
Acked-by: Artem Bityutskiy &lt;dedekind1@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>ubi: Fix error for write access</title>
<updated>2018-04-24T07:34:09+00:00</updated>
<author>
<name>Romain Izard</name>
<email>romain.izard.pro@gmail.com</email>
</author>
<published>2018-01-29T10:18:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=434a1dd2c0e4f6af3fa4ca9cc3e88bbf07b8f41c'/>
<id>434a1dd2c0e4f6af3fa4ca9cc3e88bbf07b8f41c</id>
<content type='text'>
commit 78a8dfbabbece22bee58ac4cb26cab10e7a19c5d upstream.

When opening a device with write access, ubiblock_open returns an error
code. Currently, this error code is -EPERM, but this is not the right
value.

The open function for other block devices returns -EROFS when opening
read-only devices with FMODE_WRITE set. When used with dm-verity, the
veritysetup userspace tool is expecting EROFS, and refuses to use the
ubiblock device.

Use -EROFS for ubiblock as well. As a result, veritysetup accepts the
ubiblock device as valid.

Cc: stable@vger.kernel.org
Fixes: 9d54c8a33eec (UBI: R/O block driver on top of UBI volumes)
Signed-off-by: Romain Izard &lt;romain.izard.pro@gmail.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 78a8dfbabbece22bee58ac4cb26cab10e7a19c5d upstream.

When opening a device with write access, ubiblock_open returns an error
code. Currently, this error code is -EPERM, but this is not the right
value.

The open function for other block devices returns -EROFS when opening
read-only devices with FMODE_WRITE set. When used with dm-verity, the
veritysetup userspace tool is expecting EROFS, and refuses to use the
ubiblock device.

Use -EROFS for ubiblock as well. As a result, veritysetup accepts the
ubiblock device as valid.

Cc: stable@vger.kernel.org
Fixes: 9d54c8a33eec (UBI: R/O block driver on top of UBI volumes)
Signed-off-by: Romain Izard &lt;romain.izard.pro@gmail.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>ubi: fastmap: Don't flush fastmap work on detach</title>
<updated>2018-04-24T07:34:09+00:00</updated>
<author>
<name>Richard Weinberger</name>
<email>richard@nod.at</email>
</author>
<published>2018-01-17T22:15:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=00f308c0eea4d2f7bc5bb3b9d0947f2219f53760'/>
<id>00f308c0eea4d2f7bc5bb3b9d0947f2219f53760</id>
<content type='text'>
commit 29b7a6fa1ec07e8480b0d9caf635a4498a438bf4 upstream.

At this point UBI volumes have already been free()'ed and fastmap can no
longer access these data structures.

Reported-by: Martin Townsend &lt;mtownsend1973@gmail.com&gt;
Fixes: 74cdaf24004a ("UBI: Fastmap: Fix memory leaks while closing the WL sub-system")
Cc: stable@vger.kernel.org
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 29b7a6fa1ec07e8480b0d9caf635a4498a438bf4 upstream.

At this point UBI volumes have already been free()'ed and fastmap can no
longer access these data structures.

Reported-by: Martin Townsend &lt;mtownsend1973@gmail.com&gt;
Fixes: 74cdaf24004a ("UBI: Fastmap: Fix memory leaks while closing the WL sub-system")
Cc: stable@vger.kernel.org
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>mtd: mtd_oobtest: Handle bitflips during reads</title>
<updated>2018-04-13T17:48:31+00:00</updated>
<author>
<name>Miquel Raynal</name>
<email>miquel.raynal@free-electrons.com</email>
</author>
<published>2018-01-11T20:39:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f6df92f22be342118d2eedbbcc5ca1953aab1a13'/>
<id>f6df92f22be342118d2eedbbcc5ca1953aab1a13</id>
<content type='text'>
[ Upstream commit 12663b442e5ac5aa3d6097cd3f287c71ba46d26e ]

Reads from NAND devices usually trigger bitflips, this is an expected
behavior. While bitflips are under a given threshold, the MTD core
returns 0. However, when the number of corrected bitflips is above this
same threshold, -EUCLEAN is returned to inform the upper layer that this
block is slightly dying and soon the ECC engine will be overtaken so
actions should be taken to move the data out of it.

This particular condition should not be treated like an error and the
test should continue.

Signed-off-by: Miquel Raynal &lt;miquel.raynal@free-electrons.com&gt;
Signed-off-by: Boris Brezillon &lt;boris.brezillon@free-electrons.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 12663b442e5ac5aa3d6097cd3f287c71ba46d26e ]

Reads from NAND devices usually trigger bitflips, this is an expected
behavior. While bitflips are under a given threshold, the MTD core
returns 0. However, when the number of corrected bitflips is above this
same threshold, -EUCLEAN is returned to inform the upper layer that this
block is slightly dying and soon the ECC engine will be overtaken so
actions should be taken to move the data out of it.

This particular condition should not be treated like an error and the
test should continue.

Signed-off-by: Miquel Raynal &lt;miquel.raynal@free-electrons.com&gt;
Signed-off-by: Boris Brezillon &lt;boris.brezillon@free-electrons.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mtd: nand: check ecc-&gt;total sanity in nand_scan_tail</title>
<updated>2018-04-13T17:48:15+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>yamada.masahiro@socionext.com</email>
</author>
<published>2017-05-25T04:50:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=2d0eb3f188e1de0fadaca05b413ea44c217fa7dd'/>
<id>2d0eb3f188e1de0fadaca05b413ea44c217fa7dd</id>
<content type='text'>
[ Upstream commit 79e0348c4e24fd1affdcf055e0269755580e0fcc ]

Drivers are supposed to set correct ecc-&gt;{size,strength,bytes} before
calling nand_scan_tail(), but it does not complain about ecc-&gt;total
bigger than oobsize.

In this case, chip-&gt;scan_bbt() crashes due to memory corruption, but
it is hard to debug.  It would be kind to fail it earlier with a clear
message.

Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
Signed-off-by: Boris Brezillon &lt;boris.brezillon@free-electrons.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 79e0348c4e24fd1affdcf055e0269755580e0fcc ]

Drivers are supposed to set correct ecc-&gt;{size,strength,bytes} before
calling nand_scan_tail(), but it does not complain about ecc-&gt;total
bigger than oobsize.

In this case, chip-&gt;scan_bbt() crashes due to memory corruption, but
it is hard to debug.  It would be kind to fail it earlier with a clear
message.

Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
Signed-off-by: Boris Brezillon &lt;boris.brezillon@free-electrons.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mtd: nand: gpmi: Fix gpmi_nand_init() error path</title>
<updated>2018-04-13T17:48:15+00:00</updated>
<author>
<name>Boris Brezillon</name>
<email>boris.brezillon@free-electrons.com</email>
</author>
<published>2017-04-10T08:35:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8bf4782062a0a0f6b9ca68f3f6625e1a5fe455fc'/>
<id>8bf4782062a0a0f6b9ca68f3f6625e1a5fe455fc</id>
<content type='text'>
[ Upstream commit 4d02423e9afe6c46142ce98bbcaf5167316dbfbf ]

The GPMI driver is wrongly assuming that nand_release() can safely be
called on an uninitialized/unregistered NAND device.

Add a new err_nand_cleanup label in the error path and only execute if
nand_scan_tail() succeeded.

Note that we now call nand_cleanup() instead of nand_release()
(nand_release() is actually grouping the mtd_device_unregister() and
nand_cleanup() in one call) because there's no point in trying to
unregister a device that has never been registered.

Signed-off-by: Boris Brezillon &lt;boris.brezillon@free-electrons.com&gt;
Reviewed-by: Marek Vasut &lt;marek.vasut@gmail.com&gt;
Acked-by: Han Xu &lt;han.xu@nxp.com&gt;
Reviewed-by: Marek Vasut &lt;marek.vasut@gmail.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 4d02423e9afe6c46142ce98bbcaf5167316dbfbf ]

The GPMI driver is wrongly assuming that nand_release() can safely be
called on an uninitialized/unregistered NAND device.

Add a new err_nand_cleanup label in the error path and only execute if
nand_scan_tail() succeeded.

Note that we now call nand_cleanup() instead of nand_release()
(nand_release() is actually grouping the mtd_device_unregister() and
nand_cleanup() in one call) because there's no point in trying to
unregister a device that has never been registered.

Signed-off-by: Boris Brezillon &lt;boris.brezillon@free-electrons.com&gt;
Reviewed-by: Marek Vasut &lt;marek.vasut@gmail.com&gt;
Acked-by: Han Xu &lt;han.xu@nxp.com&gt;
Reviewed-by: Marek Vasut &lt;marek.vasut@gmail.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ubi: fastmap: Fix slab corruption</title>
<updated>2018-04-13T17:47:52+00:00</updated>
<author>
<name>Rabin Vincent</name>
<email>rabinv@axis.com</email>
</author>
<published>2017-04-03T11:44:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0d84e3b5a64ac3405a103e579d8a903fad916798'/>
<id>0d84e3b5a64ac3405a103e579d8a903fad916798</id>
<content type='text'>
[ Upstream commit 8a1435880f452430b41374d27ac4a33e7bd381ea ]

Booting with UBI fastmap and SLUB debugging enabled results in the
following splats.  The problem is that ubi_scan_fastmap() moves the
fastmap blocks from the scan_ai (allocated in scan_fast()) to the ai
allocated in ubi_attach().  This results in two problems:

 - When the scan_ai is freed, aebs which were allocated from its slab
   cache are still in use.

 - When the other ai is being destroyed in destroy_ai(), the
   arguments to kmem_cache_free() call are incorrect since aebs on its
   -&gt;fastmap list were allocated with a slab cache from a differnt ai.

Fix this by making a copy of the aebs in ubi_scan_fastmap() instead of
moving them.

 =============================================================================
 BUG ubi_aeb_slab_cache (Not tainted): Objects remaining in ubi_aeb_slab_cache on __kmem_cache_shutdown()
 -----------------------------------------------------------------------------

 INFO: Slab 0xbfd2da3c objects=17 used=1 fp=0xb33d7748 flags=0x40000080
 CPU: 1 PID: 118 Comm: ubiattach Tainted: G    B           4.9.15 #3
 [&lt;80111910&gt;] (unwind_backtrace) from [&lt;8010d498&gt;] (show_stack+0x18/0x1c)
 [&lt;8010d498&gt;] (show_stack) from [&lt;804a3274&gt;] (dump_stack+0xb4/0xe0)
 [&lt;804a3274&gt;] (dump_stack) from [&lt;8026c47c&gt;] (slab_err+0x78/0x88)
 [&lt;8026c47c&gt;] (slab_err) from [&lt;802735bc&gt;] (__kmem_cache_shutdown+0x180/0x3e0)
 [&lt;802735bc&gt;] (__kmem_cache_shutdown) from [&lt;8024e13c&gt;] (shutdown_cache+0x1c/0x60)
 [&lt;8024e13c&gt;] (shutdown_cache) from [&lt;8024ed64&gt;] (kmem_cache_destroy+0x19c/0x20c)
 [&lt;8024ed64&gt;] (kmem_cache_destroy) from [&lt;8057cc14&gt;] (destroy_ai+0x1dc/0x1e8)
 [&lt;8057cc14&gt;] (destroy_ai) from [&lt;8057f04c&gt;] (ubi_attach+0x3f4/0x450)
 [&lt;8057f04c&gt;] (ubi_attach) from [&lt;8056fe70&gt;] (ubi_attach_mtd_dev+0x60c/0xff8)
 [&lt;8056fe70&gt;] (ubi_attach_mtd_dev) from [&lt;80571d78&gt;] (ctrl_cdev_ioctl+0x110/0x2b8)
 [&lt;80571d78&gt;] (ctrl_cdev_ioctl) from [&lt;8029c77c&gt;] (do_vfs_ioctl+0xac/0xa00)
 [&lt;8029c77c&gt;] (do_vfs_ioctl) from [&lt;8029d10c&gt;] (SyS_ioctl+0x3c/0x64)
 [&lt;8029d10c&gt;] (SyS_ioctl) from [&lt;80108860&gt;] (ret_fast_syscall+0x0/0x1c)
 INFO: Object 0xb33d7e88 @offset=3720
 INFO: Allocated in scan_peb+0x608/0x81c age=72 cpu=1 pid=118
 	kmem_cache_alloc+0x3b0/0x43c
 	scan_peb+0x608/0x81c
 	ubi_attach+0x124/0x450
 	ubi_attach_mtd_dev+0x60c/0xff8
 	ctrl_cdev_ioctl+0x110/0x2b8
 	do_vfs_ioctl+0xac/0xa00
 	SyS_ioctl+0x3c/0x64
 	ret_fast_syscall+0x0/0x1c
 kmem_cache_destroy ubi_aeb_slab_cache: Slab cache still has objects
 CPU: 1 PID: 118 Comm: ubiattach Tainted: G    B           4.9.15 #3
 [&lt;80111910&gt;] (unwind_backtrace) from [&lt;8010d498&gt;] (show_stack+0x18/0x1c)
 [&lt;8010d498&gt;] (show_stack) from [&lt;804a3274&gt;] (dump_stack+0xb4/0xe0)
 [&lt;804a3274&gt;] (dump_stack) from [&lt;8024ed80&gt;] (kmem_cache_destroy+0x1b8/0x20c)
 [&lt;8024ed80&gt;] (kmem_cache_destroy) from [&lt;8057cc14&gt;] (destroy_ai+0x1dc/0x1e8)
 [&lt;8057cc14&gt;] (destroy_ai) from [&lt;8057f04c&gt;] (ubi_attach+0x3f4/0x450)
 [&lt;8057f04c&gt;] (ubi_attach) from [&lt;8056fe70&gt;] (ubi_attach_mtd_dev+0x60c/0xff8)
 [&lt;8056fe70&gt;] (ubi_attach_mtd_dev) from [&lt;80571d78&gt;] (ctrl_cdev_ioctl+0x110/0x2b8)
 [&lt;80571d78&gt;] (ctrl_cdev_ioctl) from [&lt;8029c77c&gt;] (do_vfs_ioctl+0xac/0xa00)
 [&lt;8029c77c&gt;] (do_vfs_ioctl) from [&lt;8029d10c&gt;] (SyS_ioctl+0x3c/0x64)
 [&lt;8029d10c&gt;] (SyS_ioctl) from [&lt;80108860&gt;] (ret_fast_syscall+0x0/0x1c)
 cache_from_obj: Wrong slab cache. ubi_aeb_slab_cache but object is from ubi_aeb_slab_cache
 ------------[ cut here ]------------
 WARNING: CPU: 1 PID: 118 at mm/slab.h:354 kmem_cache_free+0x39c/0x450
 Modules linked in:
 CPU: 1 PID: 118 Comm: ubiattach Tainted: G    B           4.9.15 #3
 [&lt;80111910&gt;] (unwind_backtrace) from [&lt;8010d498&gt;] (show_stack+0x18/0x1c)
 [&lt;8010d498&gt;] (show_stack) from [&lt;804a3274&gt;] (dump_stack+0xb4/0xe0)
 [&lt;804a3274&gt;] (dump_stack) from [&lt;80120e40&gt;] (__warn+0xf4/0x10c)
 [&lt;80120e40&gt;] (__warn) from [&lt;80120f20&gt;] (warn_slowpath_null+0x28/0x30)
 [&lt;80120f20&gt;] (warn_slowpath_null) from [&lt;80271fe0&gt;] (kmem_cache_free+0x39c/0x450)
 [&lt;80271fe0&gt;] (kmem_cache_free) from [&lt;8057cb88&gt;] (destroy_ai+0x150/0x1e8)
 [&lt;8057cb88&gt;] (destroy_ai) from [&lt;8057ef1c&gt;] (ubi_attach+0x2c4/0x450)
 [&lt;8057ef1c&gt;] (ubi_attach) from [&lt;8056fe70&gt;] (ubi_attach_mtd_dev+0x60c/0xff8)
 [&lt;8056fe70&gt;] (ubi_attach_mtd_dev) from [&lt;80571d78&gt;] (ctrl_cdev_ioctl+0x110/0x2b8)
 [&lt;80571d78&gt;] (ctrl_cdev_ioctl) from [&lt;8029c77c&gt;] (do_vfs_ioctl+0xac/0xa00)
 [&lt;8029c77c&gt;] (do_vfs_ioctl) from [&lt;8029d10c&gt;] (SyS_ioctl+0x3c/0x64)
 [&lt;8029d10c&gt;] (SyS_ioctl) from [&lt;80108860&gt;] (ret_fast_syscall+0x0/0x1c)
 ---[ end trace 2bd8396277fd0a0b ]---
 =============================================================================
 BUG ubi_aeb_slab_cache (Tainted: G    B   W      ): page slab pointer corrupt.
 -----------------------------------------------------------------------------

 INFO: Allocated in scan_peb+0x608/0x81c age=104 cpu=1 pid=118
 	kmem_cache_alloc+0x3b0/0x43c
 	scan_peb+0x608/0x81c
 	ubi_attach+0x124/0x450
 	ubi_attach_mtd_dev+0x60c/0xff8
 	ctrl_cdev_ioctl+0x110/0x2b8
 	do_vfs_ioctl+0xac/0xa00
 	SyS_ioctl+0x3c/0x64
 	ret_fast_syscall+0x0/0x1c
 INFO: Slab 0xbfd2da3c objects=17 used=1 fp=0xb33d7748 flags=0x40000081
 INFO: Object 0xb33d7e88 @offset=3720 fp=0xb33d7da0

 Redzone b33d7e80: cc cc cc cc cc cc cc cc                          ........
 Object b33d7e88: 02 00 00 00 01 00 00 00 00 f0 ff 7f ff ff ff ff  ................
 Object b33d7e98: 00 00 00 00 00 00 00 00 bd 16 00 00 00 00 00 00  ................
 Object b33d7ea8: 00 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00  ................
 Redzone b33d7eb8: cc cc cc cc                                      ....
 Padding b33d7f60: 5a 5a 5a 5a 5a 5a 5a 5a                          ZZZZZZZZ
 CPU: 1 PID: 118 Comm: ubiattach Tainted: G    B   W       4.9.15 #3
 [&lt;80111910&gt;] (unwind_backtrace) from [&lt;8010d498&gt;] (show_stack+0x18/0x1c)
 [&lt;8010d498&gt;] (show_stack) from [&lt;804a3274&gt;] (dump_stack+0xb4/0xe0)
 [&lt;804a3274&gt;] (dump_stack) from [&lt;80271770&gt;] (free_debug_processing+0x320/0x3c4)
 [&lt;80271770&gt;] (free_debug_processing) from [&lt;80271ad0&gt;] (__slab_free+0x2bc/0x430)
 [&lt;80271ad0&gt;] (__slab_free) from [&lt;80272024&gt;] (kmem_cache_free+0x3e0/0x450)
 [&lt;80272024&gt;] (kmem_cache_free) from [&lt;8057cb88&gt;] (destroy_ai+0x150/0x1e8)
 [&lt;8057cb88&gt;] (destroy_ai) from [&lt;8057ef1c&gt;] (ubi_attach+0x2c4/0x450)
 [&lt;8057ef1c&gt;] (ubi_attach) from [&lt;8056fe70&gt;] (ubi_attach_mtd_dev+0x60c/0xff8)
 [&lt;8056fe70&gt;] (ubi_attach_mtd_dev) from [&lt;80571d78&gt;] (ctrl_cdev_ioctl+0x110/0x2b8)
 [&lt;80571d78&gt;] (ctrl_cdev_ioctl) from [&lt;8029c77c&gt;] (do_vfs_ioctl+0xac/0xa00)
 [&lt;8029c77c&gt;] (do_vfs_ioctl) from [&lt;8029d10c&gt;] (SyS_ioctl+0x3c/0x64)
 [&lt;8029d10c&gt;] (SyS_ioctl) from [&lt;80108860&gt;] (ret_fast_syscall+0x0/0x1c)
 FIX ubi_aeb_slab_cache: Object at 0xb33d7e88 not freed

Signed-off-by: Rabin Vincent &lt;rabinv@axis.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 8a1435880f452430b41374d27ac4a33e7bd381ea ]

Booting with UBI fastmap and SLUB debugging enabled results in the
following splats.  The problem is that ubi_scan_fastmap() moves the
fastmap blocks from the scan_ai (allocated in scan_fast()) to the ai
allocated in ubi_attach().  This results in two problems:

 - When the scan_ai is freed, aebs which were allocated from its slab
   cache are still in use.

 - When the other ai is being destroyed in destroy_ai(), the
   arguments to kmem_cache_free() call are incorrect since aebs on its
   -&gt;fastmap list were allocated with a slab cache from a differnt ai.

Fix this by making a copy of the aebs in ubi_scan_fastmap() instead of
moving them.

 =============================================================================
 BUG ubi_aeb_slab_cache (Not tainted): Objects remaining in ubi_aeb_slab_cache on __kmem_cache_shutdown()
 -----------------------------------------------------------------------------

 INFO: Slab 0xbfd2da3c objects=17 used=1 fp=0xb33d7748 flags=0x40000080
 CPU: 1 PID: 118 Comm: ubiattach Tainted: G    B           4.9.15 #3
 [&lt;80111910&gt;] (unwind_backtrace) from [&lt;8010d498&gt;] (show_stack+0x18/0x1c)
 [&lt;8010d498&gt;] (show_stack) from [&lt;804a3274&gt;] (dump_stack+0xb4/0xe0)
 [&lt;804a3274&gt;] (dump_stack) from [&lt;8026c47c&gt;] (slab_err+0x78/0x88)
 [&lt;8026c47c&gt;] (slab_err) from [&lt;802735bc&gt;] (__kmem_cache_shutdown+0x180/0x3e0)
 [&lt;802735bc&gt;] (__kmem_cache_shutdown) from [&lt;8024e13c&gt;] (shutdown_cache+0x1c/0x60)
 [&lt;8024e13c&gt;] (shutdown_cache) from [&lt;8024ed64&gt;] (kmem_cache_destroy+0x19c/0x20c)
 [&lt;8024ed64&gt;] (kmem_cache_destroy) from [&lt;8057cc14&gt;] (destroy_ai+0x1dc/0x1e8)
 [&lt;8057cc14&gt;] (destroy_ai) from [&lt;8057f04c&gt;] (ubi_attach+0x3f4/0x450)
 [&lt;8057f04c&gt;] (ubi_attach) from [&lt;8056fe70&gt;] (ubi_attach_mtd_dev+0x60c/0xff8)
 [&lt;8056fe70&gt;] (ubi_attach_mtd_dev) from [&lt;80571d78&gt;] (ctrl_cdev_ioctl+0x110/0x2b8)
 [&lt;80571d78&gt;] (ctrl_cdev_ioctl) from [&lt;8029c77c&gt;] (do_vfs_ioctl+0xac/0xa00)
 [&lt;8029c77c&gt;] (do_vfs_ioctl) from [&lt;8029d10c&gt;] (SyS_ioctl+0x3c/0x64)
 [&lt;8029d10c&gt;] (SyS_ioctl) from [&lt;80108860&gt;] (ret_fast_syscall+0x0/0x1c)
 INFO: Object 0xb33d7e88 @offset=3720
 INFO: Allocated in scan_peb+0x608/0x81c age=72 cpu=1 pid=118
 	kmem_cache_alloc+0x3b0/0x43c
 	scan_peb+0x608/0x81c
 	ubi_attach+0x124/0x450
 	ubi_attach_mtd_dev+0x60c/0xff8
 	ctrl_cdev_ioctl+0x110/0x2b8
 	do_vfs_ioctl+0xac/0xa00
 	SyS_ioctl+0x3c/0x64
 	ret_fast_syscall+0x0/0x1c
 kmem_cache_destroy ubi_aeb_slab_cache: Slab cache still has objects
 CPU: 1 PID: 118 Comm: ubiattach Tainted: G    B           4.9.15 #3
 [&lt;80111910&gt;] (unwind_backtrace) from [&lt;8010d498&gt;] (show_stack+0x18/0x1c)
 [&lt;8010d498&gt;] (show_stack) from [&lt;804a3274&gt;] (dump_stack+0xb4/0xe0)
 [&lt;804a3274&gt;] (dump_stack) from [&lt;8024ed80&gt;] (kmem_cache_destroy+0x1b8/0x20c)
 [&lt;8024ed80&gt;] (kmem_cache_destroy) from [&lt;8057cc14&gt;] (destroy_ai+0x1dc/0x1e8)
 [&lt;8057cc14&gt;] (destroy_ai) from [&lt;8057f04c&gt;] (ubi_attach+0x3f4/0x450)
 [&lt;8057f04c&gt;] (ubi_attach) from [&lt;8056fe70&gt;] (ubi_attach_mtd_dev+0x60c/0xff8)
 [&lt;8056fe70&gt;] (ubi_attach_mtd_dev) from [&lt;80571d78&gt;] (ctrl_cdev_ioctl+0x110/0x2b8)
 [&lt;80571d78&gt;] (ctrl_cdev_ioctl) from [&lt;8029c77c&gt;] (do_vfs_ioctl+0xac/0xa00)
 [&lt;8029c77c&gt;] (do_vfs_ioctl) from [&lt;8029d10c&gt;] (SyS_ioctl+0x3c/0x64)
 [&lt;8029d10c&gt;] (SyS_ioctl) from [&lt;80108860&gt;] (ret_fast_syscall+0x0/0x1c)
 cache_from_obj: Wrong slab cache. ubi_aeb_slab_cache but object is from ubi_aeb_slab_cache
 ------------[ cut here ]------------
 WARNING: CPU: 1 PID: 118 at mm/slab.h:354 kmem_cache_free+0x39c/0x450
 Modules linked in:
 CPU: 1 PID: 118 Comm: ubiattach Tainted: G    B           4.9.15 #3
 [&lt;80111910&gt;] (unwind_backtrace) from [&lt;8010d498&gt;] (show_stack+0x18/0x1c)
 [&lt;8010d498&gt;] (show_stack) from [&lt;804a3274&gt;] (dump_stack+0xb4/0xe0)
 [&lt;804a3274&gt;] (dump_stack) from [&lt;80120e40&gt;] (__warn+0xf4/0x10c)
 [&lt;80120e40&gt;] (__warn) from [&lt;80120f20&gt;] (warn_slowpath_null+0x28/0x30)
 [&lt;80120f20&gt;] (warn_slowpath_null) from [&lt;80271fe0&gt;] (kmem_cache_free+0x39c/0x450)
 [&lt;80271fe0&gt;] (kmem_cache_free) from [&lt;8057cb88&gt;] (destroy_ai+0x150/0x1e8)
 [&lt;8057cb88&gt;] (destroy_ai) from [&lt;8057ef1c&gt;] (ubi_attach+0x2c4/0x450)
 [&lt;8057ef1c&gt;] (ubi_attach) from [&lt;8056fe70&gt;] (ubi_attach_mtd_dev+0x60c/0xff8)
 [&lt;8056fe70&gt;] (ubi_attach_mtd_dev) from [&lt;80571d78&gt;] (ctrl_cdev_ioctl+0x110/0x2b8)
 [&lt;80571d78&gt;] (ctrl_cdev_ioctl) from [&lt;8029c77c&gt;] (do_vfs_ioctl+0xac/0xa00)
 [&lt;8029c77c&gt;] (do_vfs_ioctl) from [&lt;8029d10c&gt;] (SyS_ioctl+0x3c/0x64)
 [&lt;8029d10c&gt;] (SyS_ioctl) from [&lt;80108860&gt;] (ret_fast_syscall+0x0/0x1c)
 ---[ end trace 2bd8396277fd0a0b ]---
 =============================================================================
 BUG ubi_aeb_slab_cache (Tainted: G    B   W      ): page slab pointer corrupt.
 -----------------------------------------------------------------------------

 INFO: Allocated in scan_peb+0x608/0x81c age=104 cpu=1 pid=118
 	kmem_cache_alloc+0x3b0/0x43c
 	scan_peb+0x608/0x81c
 	ubi_attach+0x124/0x450
 	ubi_attach_mtd_dev+0x60c/0xff8
 	ctrl_cdev_ioctl+0x110/0x2b8
 	do_vfs_ioctl+0xac/0xa00
 	SyS_ioctl+0x3c/0x64
 	ret_fast_syscall+0x0/0x1c
 INFO: Slab 0xbfd2da3c objects=17 used=1 fp=0xb33d7748 flags=0x40000081
 INFO: Object 0xb33d7e88 @offset=3720 fp=0xb33d7da0

 Redzone b33d7e80: cc cc cc cc cc cc cc cc                          ........
 Object b33d7e88: 02 00 00 00 01 00 00 00 00 f0 ff 7f ff ff ff ff  ................
 Object b33d7e98: 00 00 00 00 00 00 00 00 bd 16 00 00 00 00 00 00  ................
 Object b33d7ea8: 00 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00  ................
 Redzone b33d7eb8: cc cc cc cc                                      ....
 Padding b33d7f60: 5a 5a 5a 5a 5a 5a 5a 5a                          ZZZZZZZZ
 CPU: 1 PID: 118 Comm: ubiattach Tainted: G    B   W       4.9.15 #3
 [&lt;80111910&gt;] (unwind_backtrace) from [&lt;8010d498&gt;] (show_stack+0x18/0x1c)
 [&lt;8010d498&gt;] (show_stack) from [&lt;804a3274&gt;] (dump_stack+0xb4/0xe0)
 [&lt;804a3274&gt;] (dump_stack) from [&lt;80271770&gt;] (free_debug_processing+0x320/0x3c4)
 [&lt;80271770&gt;] (free_debug_processing) from [&lt;80271ad0&gt;] (__slab_free+0x2bc/0x430)
 [&lt;80271ad0&gt;] (__slab_free) from [&lt;80272024&gt;] (kmem_cache_free+0x3e0/0x450)
 [&lt;80272024&gt;] (kmem_cache_free) from [&lt;8057cb88&gt;] (destroy_ai+0x150/0x1e8)
 [&lt;8057cb88&gt;] (destroy_ai) from [&lt;8057ef1c&gt;] (ubi_attach+0x2c4/0x450)
 [&lt;8057ef1c&gt;] (ubi_attach) from [&lt;8056fe70&gt;] (ubi_attach_mtd_dev+0x60c/0xff8)
 [&lt;8056fe70&gt;] (ubi_attach_mtd_dev) from [&lt;80571d78&gt;] (ctrl_cdev_ioctl+0x110/0x2b8)
 [&lt;80571d78&gt;] (ctrl_cdev_ioctl) from [&lt;8029c77c&gt;] (do_vfs_ioctl+0xac/0xa00)
 [&lt;8029c77c&gt;] (do_vfs_ioctl) from [&lt;8029d10c&gt;] (SyS_ioctl+0x3c/0x64)
 [&lt;8029d10c&gt;] (SyS_ioctl) from [&lt;80108860&gt;] (ret_fast_syscall+0x0/0x1c)
 FIX ubi_aeb_slab_cache: Object at 0xb33d7e88 not freed

Signed-off-by: Rabin Vincent &lt;rabinv@axis.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mtd: jedec_probe: Fix crash in jedec_read_mfr()</title>
<updated>2018-04-08T10:12:41+00:00</updated>
<author>
<name>Linus Walleij</name>
<email>linus.walleij@linaro.org</email>
</author>
<published>2018-03-03T22:29:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=760adf5cc0e042ad1f0cd54c267c0377d4b40b1e'/>
<id>760adf5cc0e042ad1f0cd54c267c0377d4b40b1e</id>
<content type='text'>
commit 87a73eb5b56fd6e07c8e499fe8608ef2d8912b82 upstream.

It turns out that the loop where we read manufacturer
jedec_read_mfd() can under some circumstances get a
CFI_MFR_CONTINUATION repeatedly, making the loop go
over all banks and eventually hit the end of the
map and crash because of an access violation:

Unable to handle kernel paging request at virtual address c4980000
pgd = (ptrval)
[c4980000] *pgd=03808811, *pte=00000000, *ppte=00000000
Internal error: Oops: 7 [#1] PREEMPT ARM
CPU: 0 PID: 1 Comm: swapper Not tainted 4.16.0-rc1+ #150
Hardware name: Gemini (Device Tree)
PC is at jedec_probe_chip+0x6ec/0xcd0
LR is at 0x4
pc : [&lt;c03a2bf4&gt;]    lr : [&lt;00000004&gt;]    psr: 60000013
sp : c382dd18  ip : 0000ffff  fp : 00000000
r10: c0626388  r9 : 00020000  r8 : c0626340
r7 : 00000000  r6 : 00000001  r5 : c3a71afc  r4 : c382dd70
r3 : 00000001  r2 : c4900000  r1 : 00000002  r0 : 00080000
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 0000397f  Table: 00004000  DAC: 00000053
Process swapper (pid: 1, stack limit = 0x(ptrval))

Fix this by breaking the loop with a return 0 if
the offset exceeds the map size.

Fixes: 5c9c11e1c47c ("[MTD] [NOR] Add support for flash chips with ID in bank other than 0")
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Boris Brezillon &lt;boris.brezillon@bootlin.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 87a73eb5b56fd6e07c8e499fe8608ef2d8912b82 upstream.

It turns out that the loop where we read manufacturer
jedec_read_mfd() can under some circumstances get a
CFI_MFR_CONTINUATION repeatedly, making the loop go
over all banks and eventually hit the end of the
map and crash because of an access violation:

Unable to handle kernel paging request at virtual address c4980000
pgd = (ptrval)
[c4980000] *pgd=03808811, *pte=00000000, *ppte=00000000
Internal error: Oops: 7 [#1] PREEMPT ARM
CPU: 0 PID: 1 Comm: swapper Not tainted 4.16.0-rc1+ #150
Hardware name: Gemini (Device Tree)
PC is at jedec_probe_chip+0x6ec/0xcd0
LR is at 0x4
pc : [&lt;c03a2bf4&gt;]    lr : [&lt;00000004&gt;]    psr: 60000013
sp : c382dd18  ip : 0000ffff  fp : 00000000
r10: c0626388  r9 : 00020000  r8 : c0626340
r7 : 00000000  r6 : 00000001  r5 : c3a71afc  r4 : c382dd70
r3 : 00000001  r2 : c4900000  r1 : 00000002  r0 : 00080000
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 0000397f  Table: 00004000  DAC: 00000053
Process swapper (pid: 1, stack limit = 0x(ptrval))

Fix this by breaking the loop with a return 0 if
the offset exceeds the map size.

Fixes: 5c9c11e1c47c ("[MTD] [NOR] Add support for flash chips with ID in bank other than 0")
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Boris Brezillon &lt;boris.brezillon@bootlin.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>mtd: nand: fsl_ifc: Read ECCSTAT0 and ECCSTAT1 registers for IFC 2.0</title>
<updated>2018-03-28T16:39:23+00:00</updated>
<author>
<name>Jagdish Gediya</name>
<email>jagdish.gediya@nxp.com</email>
</author>
<published>2018-03-21T19:38:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4d9ed68855f0844af153d70424e9e6160fe6f61c'/>
<id>4d9ed68855f0844af153d70424e9e6160fe6f61c</id>
<content type='text'>
commit 6b00c35138b404be98b85f4a703be594cbed501c upstream.

Due to missing information in Hardware manual, current
implementation doesn't read ECCSTAT0 and ECCSTAT1 registers
for IFC 2.0.

Add support to read ECCSTAT0 and ECCSTAT1 registers during
ecccheck for IFC 2.0.

Fixes: 656441478ed5 ("mtd: nand: ifc: Fix location of eccstat registers for IFC V1.0")
Cc: stable@vger.kernel.org # v3.18+
Signed-off-by: Jagdish Gediya &lt;jagdish.gediya@nxp.com&gt;
Reviewed-by: Prabhakar Kushwaha &lt;prabhakar.kushwaha@nxp.com&gt;
Signed-off-by: Boris Brezillon &lt;boris.brezillon@bootlin.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 6b00c35138b404be98b85f4a703be594cbed501c upstream.

Due to missing information in Hardware manual, current
implementation doesn't read ECCSTAT0 and ECCSTAT1 registers
for IFC 2.0.

Add support to read ECCSTAT0 and ECCSTAT1 registers during
ecccheck for IFC 2.0.

Fixes: 656441478ed5 ("mtd: nand: ifc: Fix location of eccstat registers for IFC V1.0")
Cc: stable@vger.kernel.org # v3.18+
Signed-off-by: Jagdish Gediya &lt;jagdish.gediya@nxp.com&gt;
Reviewed-by: Prabhakar Kushwaha &lt;prabhakar.kushwaha@nxp.com&gt;
Signed-off-by: Boris Brezillon &lt;boris.brezillon@bootlin.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>mtd: nand: fsl_ifc: Fix eccstat array overflow for IFC ver &gt;= 2.0.0</title>
<updated>2018-03-28T16:39:23+00:00</updated>
<author>
<name>Jagdish Gediya</name>
<email>jagdish.gediya@nxp.com</email>
</author>
<published>2018-03-21T00:21:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=eca95cb6b47a4190d3cf110d51ba186eb40e3a44'/>
<id>eca95cb6b47a4190d3cf110d51ba186eb40e3a44</id>
<content type='text'>
commit 843c3a59997f18060848b8632607dd04781b52d1 upstream.

Number of ECC status registers i.e. (ECCSTATx) has been increased in IFC
version 2.0.0 due to increase in SRAM size. This is causing eccstat
array to over flow.

So, replace eccstat array with u32 variable to make it fail-safe and
independent of number of ECC status registers or SRAM size.

Fixes: bccb06c353af ("mtd: nand: ifc: update bufnum mask for ver &gt;= 2.0.0")
Cc: stable@vger.kernel.org # 3.18+
Signed-off-by: Prabhakar Kushwaha &lt;prabhakar.kushwaha@nxp.com&gt;
Signed-off-by: Jagdish Gediya &lt;jagdish.gediya@nxp.com&gt;
Signed-off-by: Boris Brezillon &lt;boris.brezillon@bootlin.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 843c3a59997f18060848b8632607dd04781b52d1 upstream.

Number of ECC status registers i.e. (ECCSTATx) has been increased in IFC
version 2.0.0 due to increase in SRAM size. This is causing eccstat
array to over flow.

So, replace eccstat array with u32 variable to make it fail-safe and
independent of number of ECC status registers or SRAM size.

Fixes: bccb06c353af ("mtd: nand: ifc: update bufnum mask for ver &gt;= 2.0.0")
Cc: stable@vger.kernel.org # 3.18+
Signed-off-by: Prabhakar Kushwaha &lt;prabhakar.kushwaha@nxp.com&gt;
Signed-off-by: Jagdish Gediya &lt;jagdish.gediya@nxp.com&gt;
Signed-off-by: Boris Brezillon &lt;boris.brezillon@bootlin.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
</feed>
