Message ID | 20230601164537.31769-2-pmorel@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fixing infinite loop on SCLP READ SCP INFO error | expand |
diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c index acdc8a9..adf357b 100644 --- a/lib/s390x/sclp.c +++ b/lib/s390x/sclp.c @@ -119,8 +119,15 @@ void sclp_read_info(void) int sclp_get_cpu_num(void) { - assert(read_info); - return read_info->entries_cpu; + if (read_info) + return read_info->entries_cpu; + /* + * Don't abort here if read_info is NULL since abort() calls + * smp_teardown() which eventually calls this function and thus + * causes an infinite abort() chain, causing the test to hang. + * Since we obviously have at least one CPU, just return one. + */ + return 1; } CPUEntry *sclp_get_cpu_entries(void)