mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-11 03:45:21 +02:00
ubi: eba: properly rollback inside self_check_eba
commit745d9f4a31
upstream. In case of a memory allocation failure in the volumes loop we can only process the already allocated scan_eba and fm_eba array elements on the error path - others are still uninitialized. Found by Linux Verification Center (linuxtesting.org). Fixes:00abf30415
("UBI: Add self_check_eba()") Cc: stable@vger.kernel.org Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru> Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
17c312eb11
commit
3aba1db19b
|
@ -1560,6 +1560,7 @@ int self_check_eba(struct ubi_device *ubi, struct ubi_attach_info *ai_fastmap,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!fm_eba[i]) {
|
if (!fm_eba[i]) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
kfree(scan_eba[i]);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1595,7 +1596,7 @@ int self_check_eba(struct ubi_device *ubi, struct ubi_attach_info *ai_fastmap,
|
||||||
}
|
}
|
||||||
|
|
||||||
out_free:
|
out_free:
|
||||||
for (i = 0; i < num_volumes; i++) {
|
while (--i >= 0) {
|
||||||
if (!ubi->volumes[i])
|
if (!ubi->volumes[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user