[PATCH RFC 4/5] liveupdate: validate restored LUO file-set metadata
Cris Jacob Maamor
crisjacobmaamor at gmail.com
Fri May 1 02:46:36 PDT 2026
Signed-off-by: Cris Jacob Maamor <crisjacobmaamor at gmail.com>
---
kernel/liveupdate/luo_file.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c
index a0a419085e28..cde43d822f8f 100644
--- a/kernel/liveupdate/luo_file.c
+++ b/kernel/liveupdate/luo_file.c
@@ -783,11 +783,21 @@ int luo_file_deserialize(struct luo_file_set *file_set,
struct luo_file_ser *file_ser;
u64 i;
- if (!file_set_ser->files) {
- WARN_ON(file_set_ser->count);
+ if (!file_set_ser->count) {
+ if (file_set_ser->files)
+ return -EINVAL;
return 0;
}
+ if (file_set_ser->count > LUO_FILE_MAX)
+ return -EINVAL;
+
+ if (!file_set_ser->files)
+ return -EINVAL;
+
+ if (!kho_is_preserved(file_set_ser->files, LUO_FILE_PGCNT))
+ return -EINVAL;
+
file_set->count = file_set_ser->count;
file_set->files = phys_to_virt(file_set_ser->files);
--
2.53.0
More information about the kexec
mailing list