• Richard Weinberger's avatar
    ubi: Fix races around ubi_refill_pools() · 2e8f08de
    Richard Weinberger authored
    When writing a new Fastmap the first thing that happens
    is refilling the pools in memory.
    At this stage it is possible that new PEBs from the new pools
    get already claimed and written with data.
    If this happens before the new Fastmap data structure hits the
    flash and we face power cut the freshly written PEB will not
    scanned and unnoticed.
    
    Solve the issue by locking the pools until Fastmap is written.
    
    Cc: <stable@vger.kernel.org>
    Fixes: dbb7d2a8 ("UBI: Add fastmap core")
    Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
    2e8f08de
fastmap.c 39.9 KB