ubi: Correct the number of PEBs after a volume resize failure
authorZhaoLong Wang <wangzhaolong1@huawei.com>
Sat, 13 Jan 2024 13:06:01 +0000 (21:06 +0800)
committerRichard Weinberger <richard@nod.at>
Sun, 25 Feb 2024 20:39:08 +0000 (21:39 +0100)
commit9277b3a64953c09e88a33adf59fb085e0a87d357
tree9e0d4b3286fa4520b428a0c9e639b937acc56ab6
parentfbed4baed046a2815889810c396e333820b164b6
ubi: Correct the number of PEBs after a volume resize failure

In the error handling path `out_acc` of `ubi_resize_volume()`,
when `pebs < 0`, it indicates that the volume table record failed to
update when the volume was shrunk. In this case, the number of `ubi->avail_pebs`
and `ubi->rsvd_pebs` should be restored to their previous values to prevent
the UBI layer from reporting an incorrect number of available PEBs.

Signed-off-by: ZhaoLong Wang <wangzhaolong1@huawei.com>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/vmt.c