mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-25 00:52:45 -04:00
UBI: handle bit-flips when no header found
Currently UBI has one small flaw - when we read EC or VID header, but find only 0xFF bytes, we return UBI_IO_FF and do not report whether we had bit-flips or not. In case of the VID header, the scanning code adds this PEB to the free list, even though there were bit-flips. Imagine the following situation: we start writing VID header to a PEB and have a power cut, so the PEB becomes unstable. When we scan and read the PEB, we get a bit-flip. Currently, UBI would just ignore this and treat the PEB as free. This patch changes UBI behavior and now UBI will schedule this PEB for erasure. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
This commit is contained in:
@@ -748,7 +748,7 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
|
||||
return err;
|
||||
else if (err == UBI_IO_BITFLIPS)
|
||||
bitflips = 1;
|
||||
else if (err == UBI_IO_FF)
|
||||
else if (err == UBI_IO_FF || err == UBI_IO_FF_BITFLIPS)
|
||||
return add_to_list(si, pnum, UBI_SCAN_UNKNOWN_EC, &si->erase);
|
||||
else if (err == UBI_IO_BAD_HDR_EBADMSG || err == UBI_IO_BAD_HDR) {
|
||||
/*
|
||||
@@ -817,7 +817,7 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
|
||||
else if (err == UBI_IO_BITFLIPS)
|
||||
bitflips = 1;
|
||||
else if (err == UBI_IO_BAD_HDR_EBADMSG || err == UBI_IO_BAD_HDR ||
|
||||
(err == UBI_IO_FF && ec_corr)) {
|
||||
(err == UBI_IO_FF && ec_corr) || err == UBI_IO_FF_BITFLIPS) {
|
||||
/* VID header is corrupted */
|
||||
if (err == UBI_IO_BAD_HDR_EBADMSG ||
|
||||
ec_corr == UBI_IO_BAD_HDR_EBADMSG)
|
||||
|
||||
Reference in New Issue
Block a user