Skip to content

Commit c657c5d

Browse files
prati0100akpm00
authored andcommitted
mm: memfd_luo: restore and free memfd_luo_ser on failure
memfd_luo_ser has the serialization metadata. It is of no use once restoration fails. Free it on failure. Link: https://lkml.kernel.org/r/[email protected] Fixes: b3749f1 ("mm: memfd_luo: allow preserving memfd") Signed-off-by: Pratyush Yadav (Google) <[email protected]> Reviewed-by: Mike Rapoport (Microsoft) <[email protected]> Reviewed-by: Pasha Tatashin <[email protected]> Cc: Baolin Wang <[email protected]> Cc: Hugh Dickins <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 02e117b commit c657c5d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

mm/memfd_luo.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,8 @@ static int memfd_luo_retrieve(struct liveupdate_file_op_args *args)
447447
file = memfd_alloc_file("", 0);
448448
if (IS_ERR(file)) {
449449
pr_err("failed to setup file: %pe\n", file);
450-
return PTR_ERR(file);
450+
err = PTR_ERR(file);
451+
goto free_ser;
451452
}
452453

453454
vfs_setpos(file, ser->pos, MAX_LFS_FILESIZE);
@@ -473,7 +474,8 @@ static int memfd_luo_retrieve(struct liveupdate_file_op_args *args)
473474

474475
put_file:
475476
fput(file);
476-
477+
free_ser:
478+
kho_restore_free(ser);
477479
return err;
478480
}
479481

0 commit comments

Comments
 (0)