You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6
* 'linux-next' of git://git.infradead.org/ubifs-2.6: UBI: fix use-after-free on error path UBI: fix missing scrub when there is a bit-flip UBIFS: Use kmemdup rather than duplicating its implementation
This commit is contained in:
@@ -1028,12 +1028,14 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
|
||||
* 'ubi_wl_put_peb()' function on the @ubi->move_mutex. In turn, we are
|
||||
* holding @ubi->move_mutex and go sleep on the LEB lock. So, if the
|
||||
* LEB is already locked, we just do not move it and return
|
||||
* %MOVE_CANCEL_RACE, which means that UBI will re-try, but later.
|
||||
* %MOVE_RETRY. Note, we do not return %MOVE_CANCEL_RACE here because
|
||||
* we do not know the reasons of the contention - it may be just a
|
||||
* normal I/O on this LEB, so we want to re-try.
|
||||
*/
|
||||
err = leb_write_trylock(ubi, vol_id, lnum);
|
||||
if (err) {
|
||||
dbg_wl("contention on LEB %d:%d, cancel", vol_id, lnum);
|
||||
return MOVE_CANCEL_RACE;
|
||||
return MOVE_RETRY;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -120,6 +120,7 @@ enum {
|
||||
* PEB
|
||||
* MOVE_CANCEL_BITFLIPS: canceled because a bit-flip was detected in the
|
||||
* target PEB
|
||||
* MOVE_RETRY: retry scrubbing the PEB
|
||||
*/
|
||||
enum {
|
||||
MOVE_CANCEL_RACE = 1,
|
||||
@@ -127,6 +128,7 @@ enum {
|
||||
MOVE_TARGET_RD_ERR,
|
||||
MOVE_TARGET_WR_ERR,
|
||||
MOVE_CANCEL_BITFLIPS,
|
||||
MOVE_RETRY,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -795,7 +795,10 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
|
||||
protect = 1;
|
||||
goto out_not_moved;
|
||||
}
|
||||
|
||||
if (err == MOVE_RETRY) {
|
||||
scrubbing = 1;
|
||||
goto out_not_moved;
|
||||
}
|
||||
if (err == MOVE_CANCEL_BITFLIPS || err == MOVE_TARGET_WR_ERR ||
|
||||
err == MOVE_TARGET_RD_ERR) {
|
||||
/*
|
||||
@@ -1049,7 +1052,6 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
|
||||
|
||||
ubi_err("failed to erase PEB %d, error %d", pnum, err);
|
||||
kfree(wl_wrk);
|
||||
kmem_cache_free(ubi_wl_entry_slab, e);
|
||||
|
||||
if (err == -EINTR || err == -ENOMEM || err == -EAGAIN ||
|
||||
err == -EBUSY) {
|
||||
@@ -1062,14 +1064,16 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
|
||||
goto out_ro;
|
||||
}
|
||||
return err;
|
||||
} else if (err != -EIO) {
|
||||
}
|
||||
|
||||
kmem_cache_free(ubi_wl_entry_slab, e);
|
||||
if (err != -EIO)
|
||||
/*
|
||||
* If this is not %-EIO, we have no idea what to do. Scheduling
|
||||
* this physical eraseblock for erasure again would cause
|
||||
* errors again and again. Well, lets switch to R/O mode.
|
||||
*/
|
||||
goto out_ro;
|
||||
}
|
||||
|
||||
/* It is %-EIO, the PEB went bad */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user