--- zzzz-none-000/linux-5.4.213/drivers/mtd/ubi/io.c 2022-09-15 10:04:56.000000000 +0000 +++ alder-5690pro-762/linux-5.4.213/drivers/mtd/ubi/io.c 2024-08-14 09:02:07.000000000 +0000 @@ -76,6 +76,7 @@ #include #include #include +#include #include "ubi.h" static int self_check_not_bad(const struct ubi_device *ubi, int pnum); @@ -116,6 +117,7 @@ int err, retries = 0; size_t read; loff_t addr; + bool device_suspend = false; dbg_io("read %d bytes from PEB %d:%d", len, pnum, offset); @@ -169,18 +171,24 @@ ubi_assert(len == read); return UBI_IO_BITFLIPS; } - - if (retries++ < UBI_IO_RETRIES) { - ubi_warn(ubi, "error %d%s while reading %d bytes from PEB %d:%d, read only %zd bytes, retry", - err, errstr, len, pnum, offset, read); - yield(); - goto retry; +#ifdef CONFIG_KASAN + device_suspend = nand_device_suspended; +#endif + if (!device_suspend) { + if (retries++ < UBI_IO_RETRIES) { + ubi_warn(ubi, "error %d%s while reading %d bytes from PEB %d:%d, read only %zd bytes, retry", + err, errstr, len, pnum, offset, read); + yield(); + goto retry; + } + + ubi_err(ubi, "error %d%s while reading %d bytes from PEB %d:%d, read %zd bytes", + err, errstr, len, pnum, offset, read); + dump_stack(); + } else { + return 0; } - ubi_err(ubi, "error %d%s while reading %d bytes from PEB %d:%d, read %zd bytes", - err, errstr, len, pnum, offset, read); - dump_stack(); - /* * The driver should never return -EBADMSG if it failed to read * all the requested data. But some buggy drivers might do