Skip to content

Commit 64fa0de

Browse files
JaredRossihuth
authored andcommitted
pc-bios/s390-ccw: Abort IPL on invalid loadparm
Because the loadparm specifies an exact kernel the user wants to boot, if the loadparm is invalid it must represent a misconfiguration of the guest. Thus we should abort the IPL immediately, without attempting to use other devices, to avoid booting into an unintended guest image. Signed-off-by: Jared Rossi <jrossi@linux.ibm.com> Message-ID: <20250117212235.1324063-2-jrossi@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
1 parent bbfa7f8 commit 64fa0de

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pc-bios/s390-ccw/bootmap.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,7 @@ static int run_eckd_boot_script(block_number_t bmt_block_nr,
336336

337337
debug_print_int("loadparm", loadparm);
338338
if (loadparm >= MAX_BOOT_ENTRIES) {
339-
puts("loadparm value greater than max number of boot entries allowed");
340-
return -EINVAL;
339+
panic("loadparm value greater than max number of boot entries allowed");
341340
}
342341

343342
memset(sec, FREE_SPACE_FILLER, sizeof(sec));
@@ -348,8 +347,8 @@ static int run_eckd_boot_script(block_number_t bmt_block_nr,
348347

349348
block_nr = gen_eckd_block_num(&bmt->entry[loadparm].xeckd, ldipl);
350349
if (block_nr == NULL_BLOCK_NR) {
351-
puts("Cannot find Boot Map Table Entry");
352-
return -EIO;
350+
printf("The requested boot entry (%d) is invalid\n", loadparm);
351+
panic("Invalid loadparm");
353352
}
354353

355354
memset(sec, FREE_SPACE_FILLER, sizeof(sec));
@@ -792,8 +791,12 @@ static int ipl_scsi(void)
792791

793792
debug_print_int("loadparm", loadparm);
794793
if (loadparm >= MAX_BOOT_ENTRIES) {
795-
puts("loadparm value greater than max number of boot entries allowed");
796-
return -EINVAL;
794+
panic("loadparm value greater than max number of boot entries allowed");
795+
}
796+
797+
if (!valid_entries[loadparm]) {
798+
printf("The requested boot entry (%d) is invalid\n", loadparm);
799+
panic("Invalid loadparm");
797800
}
798801

799802
return zipl_run(&prog_table->entry[loadparm].scsi);

0 commit comments

Comments
 (0)