* UBI patches
@ 2014-09-11 15:16 Sascha Hauer
2014-09-11 15:16 ` [PATCH 01/10] UBI: fix error return code Sascha Hauer
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Sascha Hauer @ 2014-09-11 15:16 UTC (permalink / raw)
To: barebox
The following are the UBI fixes ported from the Kernel. This updates
UBI corresponding to Linux-3.17-rc4.
Sascha
----------------------------------------------------------------
Brian Norris (1):
UBI: fastmap: do not miss bit-flips
Dan Carpenter (1):
UBI: fix some use after free bugs
Heiko Schocher (1):
UBI: fix the volumes tree sorting criteria
Julia Lawall (1):
UBI: fix error return code
Mike Snitzer (1):
UBI: fix rb_tree node comparison in add_map
Qi Wang 王起 (qiwang) (1):
UBI: avoid program operation on NOR flash after erasure interrupted
Richard Weinberger (2):
UBI: init_volumes: Ignore volumes with no LEBs
UBI: bugfix in ubi_wl_flush()
Tanya Brokhman (2):
UBI: fix error path in __wl_get_peb
UBI: fix ubi free PEBs count calculation
drivers/mtd/ubi/attach.c | 4 +++-
drivers/mtd/ubi/fastmap.c | 12 +++++------
drivers/mtd/ubi/io.c | 54 +++++++++++++++++++----------------------------
drivers/mtd/ubi/vtbl.c | 2 +-
drivers/mtd/ubi/wl.c | 10 +++++++--
5 files changed, 40 insertions(+), 42 deletions(-)
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 01/10] UBI: fix error return code
2014-09-11 15:16 UBI patches Sascha Hauer
@ 2014-09-11 15:16 ` Sascha Hauer
2014-09-11 15:16 ` [PATCH 02/10] UBI: avoid program operation on NOR flash after erasure interrupted Sascha Hauer
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2014-09-11 15:16 UTC (permalink / raw)
To: barebox
From: Julia Lawall <Julia.Lawall@lip6.fr>
Set the return variable to an error code as done elsewhere in the function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Richard Weinberger <richard@nod.at>
---
drivers/mtd/ubi/attach.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
index 5412974..d6fe43b 100644
--- a/drivers/mtd/ubi/attach.c
+++ b/drivers/mtd/ubi/attach.c
@@ -1429,8 +1429,10 @@ int ubi_attach(struct ubi_device *ubi, int force_scan)
struct ubi_attach_info *scan_ai;
scan_ai = alloc_ai("ubi_ckh_aeb_slab_cache");
- if (!scan_ai)
+ if (!scan_ai) {
+ err = -ENOMEM;
goto out_wl;
+ }
err = scan_all(ubi, scan_ai, 0);
if (err) {
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 02/10] UBI: avoid program operation on NOR flash after erasure interrupted
2014-09-11 15:16 UBI patches Sascha Hauer
2014-09-11 15:16 ` [PATCH 01/10] UBI: fix error return code Sascha Hauer
@ 2014-09-11 15:16 ` Sascha Hauer
2014-09-11 15:16 ` [PATCH 03/10] UBI: fix some use after free bugs Sascha Hauer
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2014-09-11 15:16 UTC (permalink / raw)
To: barebox
From: Qi Wang 王起 (qiwang) <qiwang@micron.com>
nor_erase_prepare() will be called before erase a NOR flash, it will program '0'
into a block to mark this block. But program data into a erasure interrupted block
can cause program timtout(several minutes at most) error, could impact other
operation on NOR flash. So UBIFS can read this block first to avoid unneeded
program operation.
This patch try to put read operation at head of write operation in
nor_erase_prepare(), read out the data.
If the data is already corrupt, then no need to program any data into this block,
just go to erase this block.
This patch is validated on Micron NOR flash, part number is:JS28F512M29EWHA
Signed-off-by: Qi Wang <qiwang@micron.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
drivers/mtd/ubi/io.c | 54 +++++++++++++++++++++-------------------------------
1 file changed, 22 insertions(+), 32 deletions(-)
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index f9f9738..e55dfc5 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -473,10 +473,12 @@ out:
*/
static int nor_erase_prepare(struct ubi_device *ubi, int pnum)
{
- int err, err1;
+ int err;
size_t written;
loff_t addr;
uint32_t data = 0;
+ struct ubi_ec_hdr ec_hdr;
+
/*
* Note, we cannot generally define VID header buffers on stack,
* because of the way we deal with these buffers (see the header
@@ -487,50 +489,38 @@ static int nor_erase_prepare(struct ubi_device *ubi, int pnum)
struct ubi_vid_hdr vid_hdr;
/*
+ * If VID or EC is valid, we have to corrupt them before erasing.
* It is important to first invalidate the EC header, and then the VID
* header. Otherwise a power cut may lead to valid EC header and
* invalid VID header, in which case UBI will treat this PEB as
* corrupted and will try to preserve it, and print scary warnings.
*/
addr = (loff_t)pnum * ubi->peb_size;
- err = mtd_write(ubi->mtd, addr, 4, &written, (void *)&data);
- if (!err) {
- addr += ubi->vid_hdr_aloffset;
+ err = ubi_io_read_ec_hdr(ubi, pnum, &ec_hdr, 0);
+ if (err != UBI_IO_BAD_HDR_EBADMSG && err != UBI_IO_BAD_HDR &&
+ err != UBI_IO_FF){
err = mtd_write(ubi->mtd, addr, 4, &written, (void *)&data);
- if (!err)
- return 0;
+ if(err)
+ goto error;
}
- /*
- * We failed to write to the media. This was observed with Spansion
- * S29GL512N NOR flash. Most probably the previously eraseblock erasure
- * was interrupted at a very inappropriate moment, so it became
- * unwritable. In this case we probably anyway have garbage in this
- * PEB.
- */
- err1 = ubi_io_read_vid_hdr(ubi, pnum, &vid_hdr, 0);
- if (err1 == UBI_IO_BAD_HDR_EBADMSG || err1 == UBI_IO_BAD_HDR ||
- err1 == UBI_IO_FF) {
- struct ubi_ec_hdr ec_hdr;
-
- err1 = ubi_io_read_ec_hdr(ubi, pnum, &ec_hdr, 0);
- if (err1 == UBI_IO_BAD_HDR_EBADMSG || err1 == UBI_IO_BAD_HDR ||
- err1 == UBI_IO_FF)
- /*
- * Both VID and EC headers are corrupted, so we can
- * safely erase this PEB and not afraid that it will be
- * treated as a valid PEB in case of an unclean reboot.
- */
- return 0;
+ err = ubi_io_read_vid_hdr(ubi, pnum, &vid_hdr, 0);
+ if (err != UBI_IO_BAD_HDR_EBADMSG && err != UBI_IO_BAD_HDR &&
+ err != UBI_IO_FF){
+ addr += ubi->vid_hdr_aloffset;
+ err = mtd_write(ubi->mtd, addr, 4, &written, (void *)&data);
+ if (err)
+ goto error;
}
+ return 0;
+error:
/*
- * The PEB contains a valid VID header, but we cannot invalidate it.
- * Supposedly the flash media or the driver is screwed up, so return an
- * error.
+ * The PEB contains a valid VID or EC header, but we cannot invalidate
+ * it. Supposedly the flash media or the driver is screwed up, so
+ * return an error.
*/
- ubi_err("cannot invalidate PEB %d, write returned %d read returned %d",
- pnum, err, err1);
+ ubi_err("cannot invalidate PEB %d, write returned %d", pnum, err);
ubi_dump_flash(ubi, pnum, 0, ubi->peb_size);
return -EIO;
}
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 03/10] UBI: fix some use after free bugs
2014-09-11 15:16 UBI patches Sascha Hauer
2014-09-11 15:16 ` [PATCH 01/10] UBI: fix error return code Sascha Hauer
2014-09-11 15:16 ` [PATCH 02/10] UBI: avoid program operation on NOR flash after erasure interrupted Sascha Hauer
@ 2014-09-11 15:16 ` Sascha Hauer
2014-09-11 15:16 ` [PATCH 04/10] UBI: fix error path in __wl_get_peb Sascha Hauer
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2014-09-11 15:16 UTC (permalink / raw)
To: barebox
From: Dan Carpenter <dan.carpenter@oracle.com>
Move the kmem_cache_free() calls down a couple lines.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
drivers/mtd/ubi/fastmap.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index de68c32..50db661 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -462,8 +462,8 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai,
}
}
if (found_orphan) {
- kfree(tmp_aeb);
list_del(&tmp_aeb->u.list);
+ kfree(tmp_aeb);
}
new_aeb = kzalloc(sizeof(*new_aeb), GFP_KERNEL);
@@ -835,16 +835,16 @@ fail_bad:
ret = UBI_BAD_FASTMAP;
fail:
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &used, u.list) {
- free(tmp_aeb);
list_del(&tmp_aeb->u.list);
+ free(tmp_aeb);
}
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &eba_orphans, u.list) {
- free(tmp_aeb);
list_del(&tmp_aeb->u.list);
+ free(tmp_aeb);
}
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &lfree, u.list) {
- free(tmp_aeb);
list_del(&tmp_aeb->u.list);
+ free(tmp_aeb);
}
return ret;
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 04/10] UBI: fix error path in __wl_get_peb
2014-09-11 15:16 UBI patches Sascha Hauer
` (2 preceding siblings ...)
2014-09-11 15:16 ` [PATCH 03/10] UBI: fix some use after free bugs Sascha Hauer
@ 2014-09-11 15:16 ` Sascha Hauer
2014-09-11 15:16 ` [PATCH 05/10] UBI: fix ubi free PEBs count calculation Sascha Hauer
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2014-09-11 15:16 UTC (permalink / raw)
To: barebox
From: Tanya Brokhman <tlinder@codeaurora.org>
In case of an error (if there are not free PEB's for example),
__wl_get_peb will return a negative value. In order to prevent access
violation we need to test the returned value prior to using it later on.
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Reviewed-by: Dolev Raviv <draviv@codeaurora.org>
Acked-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
drivers/mtd/ubi/wl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index c083cac..4ecbe18 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -646,6 +646,9 @@ int ubi_wl_get_peb(struct ubi_device *ubi)
peb = __wl_get_peb(ubi);
+ if (peb < 0)
+ return peb;
+
err = ubi_self_check_all_ff(ubi, peb, ubi->vid_hdr_aloffset,
ubi->peb_size - ubi->vid_hdr_aloffset);
if (err) {
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 05/10] UBI: fix ubi free PEBs count calculation
2014-09-11 15:16 UBI patches Sascha Hauer
` (3 preceding siblings ...)
2014-09-11 15:16 ` [PATCH 04/10] UBI: fix error path in __wl_get_peb Sascha Hauer
@ 2014-09-11 15:16 ` Sascha Hauer
2014-09-11 15:16 ` [PATCH 06/10] UBI: fix rb_tree node comparison in add_map Sascha Hauer
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2014-09-11 15:16 UTC (permalink / raw)
To: barebox
From: Tanya Brokhman <tlinder@codeaurora.org>
The ubi->free_count should be updated with every insert/remove to/from
the ubi->free list.
Signed-off-by: Tanya Brokhman <tlinder@codeaurora.org>
Reviewed-by: Dolev Raviv <draviv@codeaurora.org>
Acked-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
drivers/mtd/ubi/wl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 4ecbe18..e52910f 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -635,6 +635,8 @@ static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi)
e = find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF);
self_check_in_wl_tree(ubi, e, &ubi->free);
+ ubi->free_count--;
+ ubi_assert(ubi->free_count >= 0);
rb_erase(&e->u.rb, &ubi->free);
return e;
@@ -1018,6 +1020,7 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
/* Give the unused PEB back */
wl_tree_add(e2, &ubi->free);
+ ubi->free_count++;
goto out_cancel;
}
self_check_in_wl_tree(ubi, e1, &ubi->used);
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 06/10] UBI: fix rb_tree node comparison in add_map
2014-09-11 15:16 UBI patches Sascha Hauer
` (4 preceding siblings ...)
2014-09-11 15:16 ` [PATCH 05/10] UBI: fix ubi free PEBs count calculation Sascha Hauer
@ 2014-09-11 15:16 ` Sascha Hauer
2014-09-11 15:16 ` [PATCH 07/10] UBI: fix the volumes tree sorting criteria Sascha Hauer
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2014-09-11 15:16 UTC (permalink / raw)
To: barebox
From: Mike Snitzer <snitzer@redhat.com>
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 <snitzer@redhat.com>
Acked-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
drivers/mtd/ubi/fastmap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 50db661..3aa7aa8 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -125,9 +125,9 @@ static struct ubi_ainf_volume *add_vol(struct ubi_attach_info *ai, int vol_id,
parent = *p;
av = rb_entry(parent, struct ubi_ainf_volume, rb);
- if (vol_id > av->vol_id)
+ if (vol_id < av->vol_id)
p = &(*p)->rb_left;
- else if (vol_id > av->vol_id)
+ else
p = &(*p)->rb_right;
}
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 07/10] UBI: fix the volumes tree sorting criteria
2014-09-11 15:16 UBI patches Sascha Hauer
` (5 preceding siblings ...)
2014-09-11 15:16 ` [PATCH 06/10] UBI: fix rb_tree node comparison in add_map Sascha Hauer
@ 2014-09-11 15:16 ` Sascha Hauer
2014-09-11 15:16 ` [PATCH 08/10] UBI: fastmap: do not miss bit-flips Sascha Hauer
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2014-09-11 15:16 UTC (permalink / raw)
To: barebox
From: Heiko Schocher <hs@denx.de>
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 <hs@denx.de>
Acked-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
drivers/mtd/ubi/fastmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 3aa7aa8..21b7f07 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -125,7 +125,7 @@ static struct ubi_ainf_volume *add_vol(struct ubi_attach_info *ai, int vol_id,
parent = *p;
av = rb_entry(parent, struct ubi_ainf_volume, rb);
- if (vol_id < av->vol_id)
+ if (vol_id > av->vol_id)
p = &(*p)->rb_left;
else
p = &(*p)->rb_right;
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 08/10] UBI: fastmap: do not miss bit-flips
2014-09-11 15:16 UBI patches Sascha Hauer
` (6 preceding siblings ...)
2014-09-11 15:16 ` [PATCH 07/10] UBI: fix the volumes tree sorting criteria Sascha Hauer
@ 2014-09-11 15:16 ` Sascha Hauer
2014-09-11 15:16 ` [PATCH 09/10] UBI: init_volumes: Ignore volumes with no LEBs Sascha Hauer
2014-09-11 15:16 ` [PATCH 10/10] UBI: bugfix in ubi_wl_flush() Sascha Hauer
9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2014-09-11 15:16 UTC (permalink / raw)
To: barebox
From: Brian Norris <computersforpeace@gmail.com>
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 <computersforpeace@gmail.com>
Acked-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
drivers/mtd/ubi/fastmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 21b7f07..8f29430 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -422,7 +422,7 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai,
pnum, err);
ret = err > 0 ? UBI_BAD_FASTMAP : err;
goto out;
- } else if (ret == UBI_IO_BITFLIPS)
+ } else if (err == UBI_IO_BITFLIPS)
scrub = 1;
/*
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 09/10] UBI: init_volumes: Ignore volumes with no LEBs
2014-09-11 15:16 UBI patches Sascha Hauer
` (7 preceding siblings ...)
2014-09-11 15:16 ` [PATCH 08/10] UBI: fastmap: do not miss bit-flips Sascha Hauer
@ 2014-09-11 15:16 ` Sascha Hauer
2014-09-11 15:16 ` [PATCH 10/10] UBI: bugfix in ubi_wl_flush() Sascha Hauer
9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2014-09-11 15:16 UTC (permalink / raw)
To: barebox
From: Richard Weinberger <richard@nod.at>
UBI assumes that ubi_attach_info will only contain ubi_ainf_volume
structures for volumes with at least one LEB.
In scanning mode this is true because UBI can nicely create a ubi_ainf_volume
on demand while creating the EBA table.
For fastmap this is not true, the fastmap on-flash structure has a list of
all volumes, the ubi_ainf_volume structures are created from this list.
So it can happen that an empty volume ends up in init_volumes().
We can easely deal with that by looking into ->leb_count too.
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
drivers/mtd/ubi/vtbl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 48b2915..c15809a 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -580,7 +580,7 @@ static int init_volumes(struct ubi_device *ubi,
/* Static volumes only */
av = ubi_find_av(ai, i);
- if (!av) {
+ if (!av || !av->leb_count) {
/*
* No eraseblocks belonging to this volume found. We
* don't actually know whether this static volume is
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 10/10] UBI: bugfix in ubi_wl_flush()
2014-09-11 15:16 UBI patches Sascha Hauer
` (8 preceding siblings ...)
2014-09-11 15:16 ` [PATCH 09/10] UBI: init_volumes: Ignore volumes with no LEBs Sascha Hauer
@ 2014-09-11 15:16 ` Sascha Hauer
9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2014-09-11 15:16 UTC (permalink / raw)
To: barebox
From: Richard Weinberger <richard@nod.at>
Use the _safe variant because we're iterating over a list where items get
deleted and freed.
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
drivers/mtd/ubi/wl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index e52910f..4c20e90 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1617,10 +1617,10 @@ int ubi_wl_flush(struct ubi_device *ubi, int vol_id, int lnum)
vol_id, lnum, ubi->works_count);
while (found) {
- struct ubi_work *wrk;
+ struct ubi_work *wrk, *tmp;
found = 0;
- list_for_each_entry(wrk, &ubi->works, list) {
+ list_for_each_entry_safe(wrk, tmp, &ubi->works, list) {
if ((vol_id == UBI_ALL || wrk->vol_id == vol_id) &&
(lnum == UBI_ALL || wrk->lnum == lnum)) {
list_del(&wrk->list);
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-09-11 15:16 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11 15:16 UBI patches Sascha Hauer
2014-09-11 15:16 ` [PATCH 01/10] UBI: fix error return code Sascha Hauer
2014-09-11 15:16 ` [PATCH 02/10] UBI: avoid program operation on NOR flash after erasure interrupted Sascha Hauer
2014-09-11 15:16 ` [PATCH 03/10] UBI: fix some use after free bugs Sascha Hauer
2014-09-11 15:16 ` [PATCH 04/10] UBI: fix error path in __wl_get_peb Sascha Hauer
2014-09-11 15:16 ` [PATCH 05/10] UBI: fix ubi free PEBs count calculation Sascha Hauer
2014-09-11 15:16 ` [PATCH 06/10] UBI: fix rb_tree node comparison in add_map Sascha Hauer
2014-09-11 15:16 ` [PATCH 07/10] UBI: fix the volumes tree sorting criteria Sascha Hauer
2014-09-11 15:16 ` [PATCH 08/10] UBI: fastmap: do not miss bit-flips Sascha Hauer
2014-09-11 15:16 ` [PATCH 09/10] UBI: init_volumes: Ignore volumes with no LEBs Sascha Hauer
2014-09-11 15:16 ` [PATCH 10/10] UBI: bugfix in ubi_wl_flush() Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox