summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTeresa Remmet <t.remmet@phytec.de>2016-06-22 11:01:57 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-06-28 07:30:00 +0200
commit8b765bebb6aecb363031838d394e360bf11bb009 (patch)
tree3dc2c325ae37d6dc406efbbb5d961c86c92f512c /drivers
parent1ebb663db9acc9e011fe2dbc071b0ef5ca02c7d8 (diff)
downloadbarebox-8b765bebb6aecb363031838d394e360bf11bb009.tar.gz
barebox-8b765bebb6aecb363031838d394e360bf11bb009.tar.xz
mtd: ubi: Fix endless loop when moving PEB
When moving a PEB the leb_write_trylock() function is called. As the function never returns 0 UBI will end up in an endless loop. Noticed the issue when fastmap has been enabled and data is beeing copied several times to a UBI volume. When UBI tries to move the anchor PEB, the issue comes up. The leb_write_trylock() is now equal to the leb_write_lock(). But kept it for easier maintaince in future when syncing with kernel. Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/ubi/eba.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index a7af247953..31dbcd29c3 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -257,16 +257,7 @@ static int leb_write_trylock(struct ubi_device *ubi, int vol_id, int lnum)
le = ltree_add_entry(ubi, vol_id, lnum);
if (IS_ERR(le))
return PTR_ERR(le);
-
- /* Contention, cancel */
- le->users -= 1;
- ubi_assert(le->users >= 0);
- if (le->users == 0) {
- rb_erase(&le->rb, &ubi->ltree);
- kfree(le);
- }
-
- return 1;
+ return 0;
}
/**