linux-stable/drivers/mtd
Wang YanQing 20ef288612 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:00:18 +09:00
..
chips mtd: cfi_cmdset_0002: Use chip_ready() for write on S29GL064N 2022-06-09 10:23:25 +02:00
devices mtd: devices: docg3: check the return value of devm_ioremap() in the probe 2022-10-26 12:35:09 +02:00
hyperbus
lpddr mtd: lpddr2_nvm: Fix possible null-ptr-deref 2022-12-31 13:14:10 +01:00
maps mtd: maps: pxa2xx-flash: fix memory leak in probe 2022-12-31 13:14:12 +01:00
nand mtd: rawnand: stm32_fmc2: use timings.mode instead of checking tRC_min 2023-04-20 12:13:52 +02:00
parsers mtd: parsers: bcm47xxpart: Fix halfblock reads 2022-11-10 18:15:32 +01:00
spi-nor mtd: spi-nor: Fix shift-out-of-bounds in spi_nor_set_erase_type 2023-03-10 09:40:05 +01:00
tests
ubi ubi: Fix return value overwrite issue in try_write_vid_and_data() 2023-05-11 23:00:18 +09:00
ftl.c
inftlcore.c
inftlmount.c
Kconfig
Makefile
mtd_blkdevs.c
mtdblock.c mtdblock: tolerate corrected bit-flips 2023-04-20 12:13:52 +02:00
mtdblock_ro.c
mtdchar.c
mtdconcat.c
mtdcore.c mtd: Fix device name leak when register device failed in add_mtd_device() 2022-12-31 13:14:09 +01:00
mtdcore.h
mtdoops.c
mtdpart.c
mtdpstore.c
mtdsuper.c
mtdswap.c
nftlcore.c
nftlmount.c
rfd_ftl.c
sm_ftl.c mtd: sm_ftl: Fix deadlock caused by cancel_work_sync in sm_release 2022-08-17 14:23:40 +02:00
sm_ftl.h
ssfdc.c