<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/mtd/ubi/fastmap.c, branch linux-3.18.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.18.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.18.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2017-04-18T05:55:45Z</updated>
<entry>
<title>UBI: fastmap: scrub PEB when bitflips are detected in a free PEB EC header</title>
<updated>2017-04-18T05:55:45Z</updated>
<author>
<name>Boris Brezillon</name>
</author>
<published>2016-09-16T14:59:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=32ab5f99793c6a1340c610e362d292f0b4137072'/>
<id>urn:sha1:32ab5f99793c6a1340c610e362d292f0b4137072</id>
<content type='text'>
commit ecbfa8eabae9cd73522d1d3d15869703c263d859 upstream.

scan_pool() does not mark the PEB for scrubing when bitflips are
detected in the EC header of a free PEB (VID header region left to
0xff).
Make sure we scrub the PEB in this case.

Signed-off-by: Boris Brezillon &lt;boris.brezillon@free-electrons.com&gt;
Fixes: dbb7d2a88d2a ("UBI: Add fastmap core")
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>UBI: Fix static volume checks when Fastmap is used</title>
<updated>2016-06-06T23:11:13Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2016-04-26T14:39:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=20f38c9653aac20261fe13cfe410627680161c47'/>
<id>urn:sha1:20f38c9653aac20261fe13cfe410627680161c47</id>
<content type='text'>
[ Upstream commit 1900149c835ab5b48bea31a823ea5e5a401fb560 ]

Ezequiel reported that he's facing UBI going into read-only
mode after power cut. It turned out that this behavior happens
only when updating a static volume is interrupted and Fastmap is
used.

A possible trace can look like:
ubi0 warning: ubi_io_read_vid_hdr [ubi]: no VID header found at PEB 2323, only 0xFF bytes
ubi0 warning: ubi_eba_read_leb [ubi]: switch to read-only mode
CPU: 0 PID: 833 Comm: ubiupdatevol Not tainted 4.6.0-rc2-ARCH #4
Hardware name: SAMSUNG ELECTRONICS CO., LTD. 300E4C/300E5C/300E7C/NP300E5C-AD8AR, BIOS P04RAP 10/15/2012
0000000000000286 00000000eba949bd ffff8800c45a7b38 ffffffff8140d841
ffff8801964be000 ffff88018eaa4800 ffff8800c45a7bb8 ffffffffa003abf6
ffffffff850e2ac0 8000000000000163 ffff8801850e2ac0 ffff8801850e2ac0
Call Trace:
[&lt;ffffffff8140d841&gt;] dump_stack+0x63/0x82
[&lt;ffffffffa003abf6&gt;] ubi_eba_read_leb+0x486/0x4a0 [ubi]
[&lt;ffffffffa00453b3&gt;] ubi_check_volume+0x83/0xf0 [ubi]
[&lt;ffffffffa0039d97&gt;] ubi_open_volume+0x177/0x350 [ubi]
[&lt;ffffffffa00375d8&gt;] vol_cdev_open+0x58/0xb0 [ubi]
[&lt;ffffffff8124b08e&gt;] chrdev_open+0xae/0x1d0
[&lt;ffffffff81243bcf&gt;] do_dentry_open+0x1ff/0x300
[&lt;ffffffff8124afe0&gt;] ? cdev_put+0x30/0x30
[&lt;ffffffff81244d36&gt;] vfs_open+0x56/0x60
[&lt;ffffffff812545f4&gt;] path_openat+0x4f4/0x1190
[&lt;ffffffff81256621&gt;] do_filp_open+0x91/0x100
[&lt;ffffffff81263547&gt;] ? __alloc_fd+0xc7/0x190
[&lt;ffffffff812450df&gt;] do_sys_open+0x13f/0x210
[&lt;ffffffff812451ce&gt;] SyS_open+0x1e/0x20
[&lt;ffffffff81a99e32&gt;] entry_SYSCALL_64_fastpath+0x1a/0xa4

UBI checks static volumes for data consistency and reads the
whole volume upon first open. If the volume is found erroneous
users of UBI cannot read from it, but another volume update is
possible to fix it. The check is performed by running
ubi_eba_read_leb() on every allocated LEB of the volume.
For static volumes ubi_eba_read_leb() computes the checksum of all
data stored in a LEB. To verify the computed checksum it has to read
the LEB's volume header which stores the original checksum.
If the volume header is not found UBI treats this as fatal internal
error and switches to RO mode. If the UBI device was attached via a
full scan the assumption is correct, the volume header has to be
present as it had to be there while scanning to get known as mapped.
If the attach operation happened via Fastmap the assumption is no
longer correct. When attaching via Fastmap UBI learns the mapping
table from Fastmap's snapshot of the system state and not via a full
scan. It can happen that a LEB got unmapped after a Fastmap was
written to the flash. Then UBI can learn the LEB still as mapped and
accessing it returns only 0xFF bytes. As UBI is not a FTL it is
allowed to have mappings to empty PEBs, it assumes that the layer
above takes care of LEB accounting and referencing.
UBIFS does so using the LEB property tree (LPT).
For static volumes UBI blindly assumes that all LEBs are present and
therefore special actions have to be taken.

The described situation can happen when updating a static volume is
interrupted, either by a user or a power cut.
The volume update code first unmaps all LEBs of a volume and then
writes LEB by LEB. If the sequence of operations is interrupted UBI
detects this either by the absence of LEBs, no volume header present
at scan time, or corrupted payload, detected via checksum.
In the Fastmap case the former method won't trigger as no scan
happened and UBI automatically thinks all LEBs are present.
Only by reading data from a LEB it detects that the volume header is
missing and incorrectly treats this as fatal error.
To deal with the situation ubi_eba_read_leb() from now on checks
whether we attached via Fastmap and handles the absence of a
volume header like a data corruption error.
This way interrupted static volume updates will correctly get detected
also when Fastmap is used.

Cc: &lt;stable@vger.kernel.org&gt;
Reported-by: Ezequiel Garcia &lt;ezequiel@vanguardiasur.com.ar&gt;
Tested-by: Ezequiel Garcia &lt;ezequiel@vanguardiasur.com.ar&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>UBI: Fastmap: Calc fastmap size correctly</title>
<updated>2014-10-03T14:33:28Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2014-09-29T22:20:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=91401a34038e614076dbfb5c4969a052e72fb296'/>
<id>urn:sha1:91401a34038e614076dbfb5c4969a052e72fb296</id>
<content type='text'>
We need to add fm_sb too.

Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Reviewed-by: Tanya Brokhman &lt;tlinder@codeaurora.org&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>UBI: add missing kmem_cache_free() in process_pool_aeb error path</title>
<updated>2014-09-16T15:18:58Z</updated>
<author>
<name>Richard Genoud</name>
</author>
<published>2014-09-09T12:25:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1bf1890e86869032099b539bc83b098be12fc5a7'/>
<id>urn:sha1:1bf1890e86869032099b539bc83b098be12fc5a7</id>
<content type='text'>
I ran into this error after a ubiupdatevol, because I forgot to backport
e9110361a9a4 UBI: fix the volumes tree sorting criteria.

UBI error: process_pool_aeb: orphaned volume in fastmap pool
UBI error: ubi_scan_fastmap: Attach by fastmap failed, doing a full scan!
kmem_cache_destroy ubi_ainf_peb_slab: Slab cache still has objects
CPU: 0 PID: 1 Comm: swapper Not tainted 3.14.18-00053-gf05cac8dbf85 #1
[&lt;c000d298&gt;] (unwind_backtrace) from [&lt;c000baa8&gt;] (show_stack+0x10/0x14)
[&lt;c000baa8&gt;] (show_stack) from [&lt;c01b7a68&gt;] (destroy_ai+0x230/0x244)
[&lt;c01b7a68&gt;] (destroy_ai) from [&lt;c01b8fd4&gt;] (ubi_attach+0x98/0x1ec)
[&lt;c01b8fd4&gt;] (ubi_attach) from [&lt;c01ade90&gt;] (ubi_attach_mtd_dev+0x2b8/0x868)
[&lt;c01ade90&gt;] (ubi_attach_mtd_dev) from [&lt;c038b510&gt;] (ubi_init+0x1dc/0x2ac)
[&lt;c038b510&gt;] (ubi_init) from [&lt;c0008860&gt;] (do_one_initcall+0x94/0x140)
[&lt;c0008860&gt;] (do_one_initcall) from [&lt;c037aadc&gt;] (kernel_init_freeable+0xe8/0x1b0)
[&lt;c037aadc&gt;] (kernel_init_freeable) from [&lt;c02730ac&gt;] (kernel_init+0x8/0xe4)
[&lt;c02730ac&gt;] (kernel_init) from [&lt;c00093f0&gt;] (ret_from_fork+0x14/0x24)
UBI: scanning is finished

Freeing the cache in the error path fixes the Slab error.

Tested on at91sam9g35 (3.14.18+fastmap backports)

Signed-off-by: Richard Genoud &lt;richard.genoud@gmail.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt; # 3.10+
</content>
</entry>
<entry>
<title>UBI: fastmap: do not miss bit-flips</title>
<updated>2014-07-16T05:32:00Z</updated>
<author>
<name>Brian Norris</name>
</author>
<published>2014-05-21T05:35:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=44305ebde243a7cce2c592cc89afe5041d8bf884'/>
<id>urn:sha1:44305ebde243a7cce2c592cc89afe5041d8bf884</id>
<content type='text'>
The return value from 'ubi_io_read_ec_hdr()' was stored in 'err', not in 'ret'.
This fix makes sure Fastmap-enabled UBI does not miss bit-flip while reading EC
headers, events and scrubs the affected PEBs.

This issue was reported by Coverity Scan.

Artem: improved the commit message.

Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Acked-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>UBI: fix the volumes tree sorting criteria</title>
<updated>2014-07-01T06:23:03Z</updated>
<author>
<name>Heiko Schocher</name>
</author>
<published>2014-06-24T07:25:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e9110361a9a4e258b072b14bd44eb78cf11453cb'/>
<id>urn:sha1:e9110361a9a4e258b072b14bd44eb78cf11453cb</id>
<content type='text'>
Commig "604b592 UBI: fix rb_tree node comparison in add_map"
broke fastmap backward compatibility and older fastmap images
cannot be mounted anymore. The reason is that it changes the
volumes RB-tree sorting criteria. This patch fixes the problem.

Artem: re-write the commit message

Signed-off-by: Heiko Schocher &lt;hs@denx.de&gt;
Acked-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>UBI: fix rb_tree node comparison in add_map</title>
<updated>2014-05-13T10:47:23Z</updated>
<author>
<name>Mike Snitzer</name>
</author>
<published>2014-03-21T19:54:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=604b592e6fd3c98f21435e1181ba7723ffc24715'/>
<id>urn:sha1:604b592e6fd3c98f21435e1181ba7723ffc24715</id>
<content type='text'>
The comparisons used in add_vol() shouldn't be identical.  Pretty sure
the following is correct but it is completely untested.

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Acked-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>UBI: fix some use after free bugs</title>
<updated>2014-02-04T07:44:30Z</updated>
<author>
<name>Dan Carpenter</name>
</author>
<published>2014-01-29T13:17:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5547fec74a566e1f5e00a937b9a367f7c6a94a8b'/>
<id>urn:sha1:5547fec74a566e1f5e00a937b9a367f7c6a94a8b</id>
<content type='text'>
Move the kmem_cache_free() calls down a couple lines.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>UBI: Add some asserts to ubi_attach_fastmap()</title>
<updated>2013-10-03T16:42:51Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2013-09-28T13:55:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ae0d146955665411a6d4cea5e0893429cfc52807'/>
<id>urn:sha1:ae0d146955665411a6d4cea5e0893429cfc52807</id>
<content type='text'>
Add more paranioa asserts to make it easier to detect
implementation errors.

Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>UBI: Fix memory leak in ubi_attach_fastmap() error path</title>
<updated>2013-10-03T16:42:50Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2013-09-28T13:55:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fe24c6e5f51ec5ea42d432f67618a084047a23ed'/>
<id>urn:sha1:fe24c6e5f51ec5ea42d432f67618a084047a23ed</id>
<content type='text'>
On error we have to free all three temporary lists.

Reported-by: Richard Genoud &lt;richard.genoud@gmail.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
</feed>
