<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/mtd/ubi/eba.c, branch linux-4.3.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.3.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.3.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2015-03-26T21:46:02Z</updated>
<entry>
<title>UBI: Fastmap: Locking updates</title>
<updated>2015-03-26T21:46:02Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2014-11-10T15:28:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=111ab0b26fc1bfad575d1e376e146d194d261e22'/>
<id>urn:sha1:111ab0b26fc1bfad575d1e376e146d194d261e22</id>
<content type='text'>
a) Rename ubi-&gt;fm_sem to ubi-&gt;fm_eba_sem as this semaphore
protects EBA changes.
b) Turn ubi-&gt;fm_mutex into a rw semaphore. It will still serialize
fastmap writes but also ensures that ubi_wl_put_peb() is not
interrupted by a fastmap write. We use a rw semaphore to allow
ubi_wl_put_peb() still to be executed in parallel if no fastmap
write is happening.

Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
<entry>
<title>UBI: Fastmap: Fix race after ubi_wl_get_peb()</title>
<updated>2015-03-26T21:46:01Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2014-11-10T15:27:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8fb2a514780eee48602424a86e3cd72d3f1bdfb2'/>
<id>urn:sha1:8fb2a514780eee48602424a86e3cd72d3f1bdfb2</id>
<content type='text'>
ubi_wl_get_peb() returns a fresh PEB which can be used by
user of UBI. Due to the pool logic fastmap will correctly
map this PEB upon attach time because it will be scanned.

If a new fastmap is written (due to heavy parallel io)
while the before the fresh PEB is assigned to the EBA table
it will not be scanned as it is no longer in the pool.
So, the race window exists between ubi_wl_get_peb()
and the EBA table assignment.
We have to make sure that no new fastmap can be written
while that.

To ensure that ubi_wl_get_peb() will grab ubi-&gt;fm_sem in read mode
and the user of ubi_wl_get_peb() has to release it after the PEB
got assigned.

Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
<entry>
<title>UBI: Fastmap: Fix race in ubi_eba_atomic_leb_change()</title>
<updated>2015-03-26T21:45:58Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2014-10-07T14:31:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=36a87e44f642966442fd0d23f2ec536851e00236'/>
<id>urn:sha1:36a87e44f642966442fd0d23f2ec536851e00236</id>
<content type='text'>
This function a) requests a new PEB, b) writes data to it,
c) returns the old PEB and d) registers the new PEB in the EBA table.

For the non-fastmap case this works perfectly fine and is powercut safe.
Is fastmap enabled this can lead to issues.
If a new fastmap is written between a) and c) the freshly requested PEB
is no longer in a pool and will not be scanned upon attaching.
If now a powercut happens between c) and d) the freshly requested PEB
will not be scanned and the old one got already scheduled for erase.
After attaching the EBA table will point to a erased PEB.

Fix this issue by swapping steps c) and d).

Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
<entry>
<title>UBI: fix out of bounds write</title>
<updated>2015-03-26T11:07:17Z</updated>
<author>
<name>Brian Norris</name>
</author>
<published>2015-02-28T10:23:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d74adbdb9abf0d2506a6c4afa534d894f28b763f'/>
<id>urn:sha1:d74adbdb9abf0d2506a6c4afa534d894f28b763f</id>
<content type='text'>
If aeb-&gt;len &gt;= vol-&gt;reserved_pebs, we should not be writing aeb into the
PEB-&gt;LEB mapping.

Caught by Coverity, CID #711212.

Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
<entry>
<title>UBI: fix missing brace control flow</title>
<updated>2015-02-23T21:17:24Z</updated>
<author>
<name>Brian Norris</name>
</author>
<published>2015-02-23T21:07:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b388e6a7a6ba988998ddd83919ae8d3debf1a13d'/>
<id>urn:sha1:b388e6a7a6ba988998ddd83919ae8d3debf1a13d</id>
<content type='text'>
commit 0e707ae79ba3 ("UBI: do propagate positive error codes up") seems
to have produced an unintended change in the control flow here.

Completely untested, but it looks obvious.

Caught by Coverity, which didn't like the indentation. CID 1271184.

Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Cc: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
<entry>
<title>UBI: do propagate positive error codes up</title>
<updated>2015-01-28T15:09:25Z</updated>
<author>
<name>Artem Bityutskiy</name>
</author>
<published>2014-11-25T09:34:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0e707ae79ba357d60b8a36025ec8968e5020d827'/>
<id>urn:sha1:0e707ae79ba357d60b8a36025ec8968e5020d827</id>
<content type='text'>
UBI uses positive function return codes internally, and should not propagate
them up, except in the place this path fixes. Here is the original bug report
from Dan Carpenter:

The problem is really in ubi_eba_read_leb().

drivers/mtd/ubi/eba.c
   412                  err = ubi_io_read_vid_hdr(ubi, pnum, vid_hdr, 1);
   413                  if (err &amp;&amp; err != UBI_IO_BITFLIPS) {
   414                          if (err &gt; 0) {
   415                                  /*
   416                                   * The header is either absent or corrupted.
   417                                   * The former case means there is a bug -
   418                                   * switch to read-only mode just in case.
   419                                   * The latter case means a real corruption - we
   420                                   * may try to recover data. FIXME: but this is
   421                                   * not implemented.
   422                                   */
   423                                  if (err == UBI_IO_BAD_HDR_EBADMSG ||
   424                                      err == UBI_IO_BAD_HDR) {
   425                                          ubi_warn("corrupted VID header at PEB %d, LEB %d:%d",
   426                                                   pnum, vol_id, lnum);
   427                                          err = -EBADMSG;
   428                                  } else
   429                                          ubi_ro_mode(ubi);

On this path we return UBI_IO_FF and UBI_IO_FF_BITFLIPS and it
eventually gets passed to ERR_PTR().  We probably dereference the bad
pointer and oops.  At that point we've gone read only so it was already
a bad situation...

   430                          }
   431                          goto out_free;
   432                  } else if (err == UBI_IO_BITFLIPS)
   433                          scrub = 1;
   434

Reported-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 initial support for scatter gather</title>
<updated>2015-01-28T15:04:26Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2015-01-10T21:52:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9ff08979e17423f0f691c1d76f35dfec72a5e459'/>
<id>urn:sha1:9ff08979e17423f0f691c1d76f35dfec72a5e459</id>
<content type='text'>
Adds a new set of functions to deal with scatter gather.
ubi_eba_read_leb_sg() will read from a LEB into a scatter gather list.
The new data structure struct ubi_sgl will be used within UBI to
hold the scatter gather list itself and metadata to have a cursor
within the list.

Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Tested-by: Ezequiel Garcia &lt;ezequiel@vanguardiasur.com.ar&gt;
Reviewed-by: Ezequiel Garcia &lt;ezequiel@vanguardiasur.com.ar&gt;
</content>
</entry>
<entry>
<title>UBI: Extend UBI layer debug/messaging capabilities</title>
<updated>2014-11-07T10:08:51Z</updated>
<author>
<name>Tanya Brokhman</name>
</author>
<published>2014-10-20T16:57:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=326087033108e7806e24974f2c8271f95cddaf3a'/>
<id>urn:sha1:326087033108e7806e24974f2c8271f95cddaf3a</id>
<content type='text'>
If there is more then one UBI device mounted, there is no way to
distinguish between messages from different UBI devices.
Add device number to all ubi layer message types.

The R/O block driver messages were replaced by pr_* since
ubi_device structure is not used by it.

Amended a bit by Artem.

Signed-off-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: ubi_eba_read_leb: Remove in vain variable assignment</title>
<updated>2014-09-26T10:42:41Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2014-09-22T08:45:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=170505f58f01d89dea2667d484cb5da18fb9ffd9'/>
<id>urn:sha1:170505f58f01d89dea2667d484cb5da18fb9ffd9</id>
<content type='text'>
There is no need to set err, it will be overwritten in any case
later at:
        if (scrub)
                err = ubi_wl_scrub_peb(ubi, pnum);

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: Wire-up -&gt;fm_sem</title>
<updated>2012-10-03T09:29:37Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2012-09-26T15:51:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8974b15c6e84e686201d382c7d459aa9c8c96572'/>
<id>urn:sha1:8974b15c6e84e686201d382c7d459aa9c8c96572</id>
<content type='text'>
Fastmap uses -&gt;fm_sem to stop EBA changes while writing
a new fastmap.

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>
