File s390-tools-sles15sp2-zipl-prevent-endless-loop-during-IPL.patch of Package s390-tools.19608

Subject: [PATCH] [BZ 186939] zipl: prevent endless loop during secure IPL
From: Stefan Haberland <sth@linux.ibm.com>

Description:   zipl: prevent endless loop during secure IPL
Symptom:       During IPL with secure boot enabled the loader may loop
               infinitely.
Problem:       In case secure boot is enabled but no components in the
               IPL report are found it ends up in an endless loop in
               the component verification.
Solution:      To prevent this check if components are found and exit
               if not.
Reproduction:  IPL with secure boot enabled.
Upstream-ID:   d5a88c1e56852881e8b0bb4056ffaa25bea818c5
Problem-ID:    186939

Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
---
 zipl/boot/stage3.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/zipl/boot/stage3.c
+++ b/zipl/boot/stage3.c
@@ -104,6 +104,10 @@ is_verified_address(unsigned long image_
 
 		rb_hdr = (void *) rb_hdr + rb_hdr->len;
 	}
+
+	if (!comps)
+		return 0;
+
 	for_each_rb_entry(comp, comps) {
 		if (image_addr == comp->addr &&
 		    comp->flags & IPL_RB_COMPONENT_FLAG_SIGNED &&
openSUSE Build Service is sponsored by