mirror-linux/drivers/mtd
Wang YanQing 884e961674 ubi: Fix return value overwrite issue in try_write_vid_and_data()
commit 31a149d5c1 upstream.

The commit 2d78aee426 ("UBI: simplify LEB write and atomic LEB change code")
adds helper function, try_write_vid_and_data(), to simplify the code, but this
helper function has bug, it will return 0 (success) when ubi_io_write_vid_hdr()
or the ubi_io_write_data() return error number (-EIO, etc), because the return
value of ubi_wl_put_peb() will overwrite the original return value.

This issue will cause unexpected data loss issue, because the caller of this
function and UBIFS willn't know the data is lost.

Fixes: 2d78aee426 ("UBI: simplify LEB write and atomic LEB change code")
Cc: stable@vger.kernel.org
Signed-off-by: Wang YanQing <udknight@gmail.com>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-11 23:03:05 +09:00
..
chips
devices
hyperbus
lpddr mtd: lpddr2_nvm: Fix possible null-ptr-deref 2022-12-31 13:32:12 +01:00
maps mtd: maps: pxa2xx-flash: fix memory leak in probe 2022-12-31 13:32:15 +01:00
nand mtd: rawnand: stm32_fmc2: use timings.mode instead of checking tRC_min 2023-04-20 12:35:07 +02:00
parsers mtd: parsers: scpart: fix __udivdi3 undefined on mips 2023-01-18 11:58:24 +01:00
spi-nor mtd: spi-nor: fix memory leak when using debugfs_lookup() 2023-04-26 14:28:37 +02:00
tests
ubi ubi: Fix return value overwrite issue in try_write_vid_and_data() 2023-05-11 23:03:05 +09:00
Kconfig
Makefile
ftl.c
inftlcore.c
inftlmount.c
mtd_blkdevs.c
mtdblock.c mtdblock: tolerate corrected bit-flips 2023-04-20 12:35:06 +02:00
mtdblock_ro.c
mtdchar.c
mtdconcat.c
mtdcore.c mtd: core: Fix refcount error in del_mtd_device() 2022-12-31 13:32:15 +01:00
mtdcore.h
mtdoops.c
mtdpart.c mtd: mtdpart: Don't create platform device that'll never probe 2023-03-10 09:33:38 +01:00
mtdpstore.c
mtdsuper.c
mtdswap.c
nftlcore.c
nftlmount.c
rfd_ftl.c
sm_ftl.c
sm_ftl.h
ssfdc.c