<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/drivers/mtd, branch v3.2.73</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.73</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.73'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2015-11-17T15:54:41Z</updated>
<entry>
<title>UBI: return ENOSPC if no enough space available</title>
<updated>2015-11-17T15:54:41Z</updated>
<author>
<name>shengyong</name>
<email>shengyong1@huawei.com</email>
</author>
<published>2015-09-28T17:57:19Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=02eb3b901e81417a8a0c9f2338fa24d8a7d00093'/>
<id>urn:sha1:02eb3b901e81417a8a0c9f2338fa24d8a7d00093</id>
<content type='text'>
commit 7c7feb2ebfc9c0552c51f0c050db1d1a004faac5 upstream.

UBI: attaching mtd1 to ubi0
UBI: scanning is finished
UBI error: init_volumes: not enough PEBs, required 706, available 686
UBI error: ubi_wl_init: no enough physical eraseblocks (-20, need 1)
UBI error: ubi_attach_mtd_dev: failed to attach mtd1, error -12 &lt;= NOT ENOMEM
UBI error: ubi_init: cannot attach mtd1

If available PEBs are not enough when initializing volumes, return -ENOSPC
directly. If available PEBs are not enough when initializing WL, return
-ENOSPC instead of -ENOMEM.

Signed-off-by: Sheng Yong &lt;shengyong1@huawei.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Reviewed-by: David Gstir &lt;david@sigma-star.at&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>UBI: Validate data_size</title>
<updated>2015-11-17T15:54:41Z</updated>
<author>
<name>Richard Weinberger</name>
<email>richard@nod.at</email>
</author>
<published>2015-09-22T21:58:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=73d95e7b04162376761b6c942d74cd18b1556dce'/>
<id>urn:sha1:73d95e7b04162376761b6c942d74cd18b1556dce</id>
<content type='text'>
commit 281fda27673f833a01d516658a64d22a32c8e072 upstream.

Make sure that data_size is less than LEB size.
Otherwise a handcrafted UBI image is able to trigger
an out of bounds memory access in ubi_compare_lebs().

Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Reviewed-by: David Gstir &lt;david@sigma-star.at&gt;
[bwh: Backported to 3.2: drop first argument to ubi_err()]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>mtd: dc21285: use raw spinlock functions for nw_gpio_lock</title>
<updated>2015-08-12T14:33:13Z</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@pengutronix.de</email>
</author>
<published>2015-05-28T08:22:10Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3d0b261c65b60df9dde561616217f93f8e411bdb'/>
<id>urn:sha1:3d0b261c65b60df9dde561616217f93f8e411bdb</id>
<content type='text'>
commit e5babdf928e5d0c432a8d4b99f20421ce14d1ab6 upstream.

Since commit bd31b85960a7 (which is in 3.2-rc1) nw_gpio_lock is a raw spinlock
that needs usage of the corresponding raw functions.

This fixes:

  drivers/mtd/maps/dc21285.c: In function 'nw_en_write':
  drivers/mtd/maps/dc21285.c:41:340: warning: passing argument 1 of 'spinlock_check' from incompatible pointer type
    spin_lock_irqsave(&amp;nw_gpio_lock, flags);

  In file included from include/linux/seqlock.h:35:0,
                   from include/linux/time.h:5,
                   from include/linux/stat.h:18,
                   from include/linux/module.h:10,
                   from drivers/mtd/maps/dc21285.c:8:
  include/linux/spinlock.h:299:102: note: expected 'struct spinlock_t *' but argument is of type 'struct raw_spinlock_t *'
   static inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
                                                                                                        ^
  drivers/mtd/maps/dc21285.c:43:25: warning: passing argument 1 of 'spin_unlock_irqrestore' from incompatible pointer type
    spin_unlock_irqrestore(&amp;nw_gpio_lock, flags);
                           ^
  In file included from include/linux/seqlock.h:35:0,
                   from include/linux/time.h:5,
                   from include/linux/stat.h:18,
                   from include/linux/module.h:10,
                   from drivers/mtd/maps/dc21285.c:8:
  include/linux/spinlock.h:370:91: note: expected 'struct spinlock_t *' but argument is of type 'struct raw_spinlock_t *'
   static inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)

Fixes: bd31b85960a7 ("locking, ARM: Annotate low level hw locks as raw")
Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>mtd: fix: avoid race condition when accessing mtd-&gt;usecount</title>
<updated>2015-08-12T14:33:11Z</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2015-05-08T00:55:16Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5d8caffb9c2959cf994a109174981a443c213686'/>
<id>urn:sha1:5d8caffb9c2959cf994a109174981a443c213686</id>
<content type='text'>
commit 073db4a51ee43ccb827f54a4261c0583b028d5ab upstream.

On A MIPS 32-cores machine a BUG_ON was triggered because some acesses to
mtd-&gt;usecount were done without taking mtd_table_mutex.
kernel: Call Trace:
kernel: [&lt;ffffffff80401818&gt;] __put_mtd_device+0x20/0x50
kernel: [&lt;ffffffff804086f4&gt;] blktrans_release+0x8c/0xd8
kernel: [&lt;ffffffff802577e0&gt;] __blkdev_put+0x1a8/0x200
kernel: [&lt;ffffffff802579a4&gt;] blkdev_close+0x1c/0x30
kernel: [&lt;ffffffff8022006c&gt;] __fput+0xac/0x250
kernel: [&lt;ffffffff80171208&gt;] task_work_run+0xd8/0x120
kernel: [&lt;ffffffff8012c23c&gt;] work_notifysig+0x10/0x18
kernel:
kernel:
        Code: 2442ffff  ac8202d8  000217fe &lt;00020336&gt; dc820128  10400003
               00000000  0040f809  00000000
kernel: ---[ end trace 080fbb4579b47a73 ]---

Fixed by taking the mutex in blktrans_open and blktrans_release.

Note that this locking is already suggested in
include/linux/mtd/blktrans.h:

struct mtd_blktrans_ops {
...
	/* Called with mtd_table_mutex held; no race with add/remove */
	int (*open)(struct mtd_blktrans_dev *dev);
	void (*release)(struct mtd_blktrans_dev *dev);
...
};

But we weren't following it.

Originally reported by (and patched by) Zhang and Giuseppe,
independently. Improved and rewritten.

Reported-by: Zhang Xingcai &lt;zhangxingcai@huawei.com&gt;
Reported-by: Giuseppe Cantavenera &lt;giuseppe.cantavenera.ext@nokia.com&gt;
Tested-by: Giuseppe Cantavenera &lt;giuseppe.cantavenera.ext@nokia.com&gt;
Acked-by: Alexander Sverdlin &lt;alexander.sverdlin@nokia.com&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>UBI: fix soft lockup in ubi_check_volume()</title>
<updated>2015-08-06T23:32:19Z</updated>
<author>
<name>hujianyang</name>
<email>hujianyang@huawei.com</email>
</author>
<published>2014-12-30T03:56:09Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6876b78ee008e416e3802e376cf9392e14b9c92a'/>
<id>urn:sha1:6876b78ee008e416e3802e376cf9392e14b9c92a</id>
<content type='text'>
commit 9aa272b492e7551a9ee0e2c83c720ea013698485 upstream.

Running mtd-utils/tests/ubi-tests/io_basic.c could cause
soft lockup or watchdog reset. It is because *updatevol*
will perform ubi_check_volume() after updating finish
and this function will full scan the updated lebs if the
volume is initialized as STATIC_VOLUME.

This patch adds *cond_resched()* in the loop of lebs scan
to avoid soft lockup.

Helped by Richard Weinberger &lt;richard@nod.at&gt;

[ 2158.067096] INFO: rcu_sched self-detected stall on CPU { 1}  (t=2101 jiffies g=1606 c=1605 q=56)
[ 2158.172867] CPU: 1 PID: 2073 Comm: io_basic Tainted: G           O 3.10.53 #21
[ 2158.172898] [&lt;c000f624&gt;] (unwind_backtrace+0x0/0x120) from [&lt;c000c294&gt;] (show_stack+0x10/0x14)
[ 2158.172918] [&lt;c000c294&gt;] (show_stack+0x10/0x14) from [&lt;c008ac3c&gt;] (rcu_check_callbacks+0x1c0/0x660)
[ 2158.172936] [&lt;c008ac3c&gt;] (rcu_check_callbacks+0x1c0/0x660) from [&lt;c002b480&gt;] (update_process_times+0x38/0x64)
[ 2158.172953] [&lt;c002b480&gt;] (update_process_times+0x38/0x64) from [&lt;c005ff38&gt;] (tick_sched_handle+0x54/0x60)
[ 2158.172966] [&lt;c005ff38&gt;] (tick_sched_handle+0x54/0x60) from [&lt;c00601ac&gt;] (tick_sched_timer+0x44/0x74)
[ 2158.172978] [&lt;c00601ac&gt;] (tick_sched_timer+0x44/0x74) from [&lt;c003f348&gt;] (__run_hrtimer+0xc8/0x1b8)
[ 2158.172992] [&lt;c003f348&gt;] (__run_hrtimer+0xc8/0x1b8) from [&lt;c003fd9c&gt;] (hrtimer_interrupt+0x128/0x2a4)
[ 2158.173007] [&lt;c003fd9c&gt;] (hrtimer_interrupt+0x128/0x2a4) from [&lt;c0246f1c&gt;] (arch_timer_handler_virt+0x28/0x30)
[ 2158.173022] [&lt;c0246f1c&gt;] (arch_timer_handler_virt+0x28/0x30) from [&lt;c0086214&gt;] (handle_percpu_devid_irq+0x9c/0x124)
[ 2158.173036] [&lt;c0086214&gt;] (handle_percpu_devid_irq+0x9c/0x124) from [&lt;c0082bd8&gt;] (generic_handle_irq+0x20/0x30)
[ 2158.173049] [&lt;c0082bd8&gt;] (generic_handle_irq+0x20/0x30) from [&lt;c000969c&gt;] (handle_IRQ+0x64/0x8c)
[ 2158.173060] [&lt;c000969c&gt;] (handle_IRQ+0x64/0x8c) from [&lt;c0008544&gt;] (gic_handle_irq+0x3c/0x60)
[ 2158.173074] [&lt;c0008544&gt;] (gic_handle_irq+0x3c/0x60) from [&lt;c02f0f80&gt;] (__irq_svc+0x40/0x50)
[ 2158.173083] Exception stack(0xc4043c98 to 0xc4043ce0)
[ 2158.173092] 3c80:                                                       c4043ce4 00000019
[ 2158.173102] 3ca0: 1f8a865f c050ad10 1f8a864c 00000031 c04b5970 0003ebce 00000000 f3550000
[ 2158.173113] 3cc0: bf00bc68 00000800 0003ebce c4043ce0 c0186d14 c0186cb8 80000013 ffffffff
[ 2158.173130] [&lt;c02f0f80&gt;] (__irq_svc+0x40/0x50) from [&lt;c0186cb8&gt;] (read_current_timer+0x4/0x38)
[ 2158.173145] [&lt;c0186cb8&gt;] (read_current_timer+0x4/0x38) from [&lt;1f8a865f&gt;] (0x1f8a865f)
[ 2183.927097] BUG: soft lockup - CPU#1 stuck for 22s! [io_basic:2073]
[ 2184.002229] Modules linked in: nandflash(O) [last unloaded: nandflash]

Signed-off-by: Wang Kai &lt;morgan.wang@huawei.com&gt;
Signed-off-by: hujianyang &lt;hujianyang@huawei.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>UBI: fix check for "too many bytes"</title>
<updated>2015-08-06T23:32:01Z</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2015-02-28T10:23:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e406cf29146f6aa1213a573dcc96c661c4a485c5'/>
<id>urn:sha1:e406cf29146f6aa1213a573dcc96c661c4a485c5</id>
<content type='text'>
commit 299d0c5b27346a77a0777c993372bf8777d4f2e5 upstream.

The comparison from the previous line seems to have been erroneously
(partially) copied-and-pasted onto the next. The second line should be
checking req.bytes, not req.lnum.

Coverity CID #139400

Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
[rw: Fixed comparison]
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>UBI: initialize LEB number variable</title>
<updated>2015-08-06T23:32:01Z</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2015-02-28T10:23:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a966861972654ab3fdfd736e8932e4c4798b34bf'/>
<id>urn:sha1:a966861972654ab3fdfd736e8932e4c4798b34bf</id>
<content type='text'>
commit f16db8071ce18819fbd705ddcc91c6f392fb61f8 upstream.

In some of the 'out_not_moved' error paths, lnum may be used
uninitialized. Don't ignore the warning; let's fix it.

This uninitialized variable doesn't have much visible effect in the end,
since we just schedule the PEB for erasure, and its LEB number doesn't
really matter (it just gets printed in debug messages). But let's get it
straight anyway.

Coverity CID #113449

Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>UBI: fix out of bounds write</title>
<updated>2015-08-06T23:32:01Z</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2015-02-28T10:23:26Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4d1519d8538a6a91ffcd10d56a15f538804b5bad'/>
<id>urn:sha1:4d1519d8538a6a91ffcd10d56a15f538804b5bad</id>
<content type='text'>
commit d74adbdb9abf0d2506a6c4afa534d894f28b763f upstream.

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.

Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
[bwh: Backported to 3.2: adjust context; s/leb/seb/g]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>UBI: account for bitflips in both the VID header and data</title>
<updated>2015-08-06T23:32:01Z</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2015-02-28T10:23:25Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5daa0af639b0be923694f1e12f3029f0562f8dfc'/>
<id>urn:sha1:5daa0af639b0be923694f1e12f3029f0562f8dfc</id>
<content type='text'>
commit 8eef7d70f7c6772c3490f410ee2bceab3b543fa1 upstream.

We are completely discarding the earlier value of 'bitflips', which
could reflect a bitflip found in ubi_io_read_vid_hdr(). Let's use the
bitwise OR of header and data 'bitflip' statuses instead.

Coverity CID #1226856

Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>UBI: Fix invalid vfree()</title>
<updated>2015-02-20T00:49:24Z</updated>
<author>
<name>Richard Weinberger</name>
<email>richard@nod.at</email>
</author>
<published>2014-10-26T23:46:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=83e1f5831dc8fb25704bba388c5cd0e8780e5fff'/>
<id>urn:sha1:83e1f5831dc8fb25704bba388c5cd0e8780e5fff</id>
<content type='text'>
commit f38aed975c0c3645bbdfc5ebe35726e64caaf588 upstream.

The logic of vfree()'ing vol-&gt;upd_buf is tied to vol-&gt;updating.
In ubi_start_update() vol-&gt;updating is set long before vmalloc()'ing
vol-&gt;upd_buf. If we encounter a write failure in ubi_start_update()
before vmalloc() the UBI device release function will try to vfree()
vol-&gt;upd_buf because vol-&gt;updating is set.
Fix this by allocating vol-&gt;upd_buf directly after setting vol-&gt;updating.

Fixes:
[   31.559338] UBI warning: vol_cdev_release: update of volume 2 not finished, volume is damaged
[   31.559340] ------------[ cut here ]------------
[   31.559343] WARNING: CPU: 1 PID: 2747 at mm/vmalloc.c:1446 __vunmap+0xe3/0x110()
[   31.559344] Trying to vfree() nonexistent vm area (ffffc90001f2b000)
[   31.559345] Modules linked in:
[   31.565620]  0000000000000bba ffff88002a0cbdb0 ffffffff818f0497 ffff88003b9ba148
[   31.566347]  ffff88002a0cbde0 ffffffff8156f515 ffff88003b9ba148 0000000000000bba
[   31.567073]  0000000000000000 0000000000000000 ffff88002a0cbe88 ffffffff8156c10a
[   31.567793] Call Trace:
[   31.568034]  [&lt;ffffffff818f0497&gt;] dump_stack+0x4e/0x7a
[   31.568510]  [&lt;ffffffff8156f515&gt;] ubi_io_write_vid_hdr+0x155/0x160
[   31.569084]  [&lt;ffffffff8156c10a&gt;] ubi_eba_write_leb+0x23a/0x870
[   31.569628]  [&lt;ffffffff81569b36&gt;] vol_cdev_write+0x226/0x380
[   31.570155]  [&lt;ffffffff81179265&gt;] vfs_write+0xb5/0x1f0
[   31.570627]  [&lt;ffffffff81179f8a&gt;] SyS_pwrite64+0x6a/0xa0
[   31.571123]  [&lt;ffffffff818fde12&gt;] system_call_fastpath+0x16/0x1b

Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
</feed>
