Skip to content

Commit f1da345

Browse files
committed
Merge tag 'upstream-3.12-rc1' of git://git.infradead.org/linux-ubi
Pull UBI fixes from Artem Bityutskiy: "Just a single fastmap fix plus a regression fix" * tag 'upstream-3.12-rc1' of git://git.infradead.org/linux-ubi: UBI: Fix invalidate_fastmap() UBI: Fix PEB leak in wear_leveling_worker()
2 parents 098e7f1 + 8930fa5 commit f1da345

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

drivers/mtd/ubi/fastmap.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,7 @@ static int erase_block(struct ubi_device *ubi, int pnum)
13431343
static int invalidate_fastmap(struct ubi_device *ubi,
13441344
struct ubi_fastmap_layout *fm)
13451345
{
1346-
int ret, i;
1346+
int ret;
13471347
struct ubi_vid_hdr *vh;
13481348

13491349
ret = erase_block(ubi, fm->e[0]->pnum);
@@ -1360,9 +1360,6 @@ static int invalidate_fastmap(struct ubi_device *ubi,
13601360
vh->sqnum = cpu_to_be64(ubi_next_sqnum(ubi));
13611361
ret = ubi_io_write_vid_hdr(ubi, fm->e[0]->pnum, vh);
13621362

1363-
for (i = 0; i < fm->used_blocks; i++)
1364-
ubi_wl_put_fm_peb(ubi, fm->e[i], i, fm->to_be_tortured[i]);
1365-
13661363
return ret;
13671364
}
13681365

drivers/mtd/ubi/wl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,9 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
10691069
if (!(e2->ec - e1->ec >= UBI_WL_THRESHOLD)) {
10701070
dbg_wl("no WL needed: min used EC %d, max free EC %d",
10711071
e1->ec, e2->ec);
1072+
1073+
/* Give the unused PEB back */
1074+
wl_tree_add(e2, &ubi->free);
10721075
goto out_cancel;
10731076
}
10741077
self_check_in_wl_tree(ubi, e1, &ubi->used);

0 commit comments

Comments
 (0)