aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2014-07-27 03:35:48 -0400
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2014-07-28 12:07:33 -0400
commit49e236bc4a2639af0e77b3a05460e8367e3187a4 (patch)
tree2cb521b8ee526da62921ed057f5de9f8ef6d0e52 /drivers/mtd
parent4df38926f337ff4de49a8fb512aa4a55df0c502d (diff)
UBI: bugfix in ubi_wl_flush()
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>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/wl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 0f3425dac910..20f491713145 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1718,12 +1718,12 @@ int ubi_wl_flush(struct ubi_device *ubi, int vol_id, int lnum)
1718 vol_id, lnum, ubi->works_count); 1718 vol_id, lnum, ubi->works_count);
1719 1719
1720 while (found) { 1720 while (found) {
1721 struct ubi_work *wrk; 1721 struct ubi_work *wrk, *tmp;
1722 found = 0; 1722 found = 0;
1723 1723
1724 down_read(&ubi->work_sem); 1724 down_read(&ubi->work_sem);
1725 spin_lock(&ubi->wl_lock); 1725 spin_lock(&ubi->wl_lock);
1726 list_for_each_entry(wrk, &ubi->works, list) { 1726 list_for_each_entry_safe(wrk, tmp, &ubi->works, list) {
1727 if ((vol_id == UBI_ALL || wrk->vol_id == vol_id) && 1727 if ((vol_id == UBI_ALL || wrk->vol_id == vol_id) &&
1728 (lnum == UBI_ALL || wrk->lnum == lnum)) { 1728 (lnum == UBI_ALL || wrk->lnum == lnum)) {
1729 list_del(&wrk->list); 1729 list_del(&wrk->list);