diff --git a/backport-avoid-infinite-loop-on-allocation-failure-in.patch b/backport-avoid-infinite-loop-on-allocation-failure-in.patch new file mode 100644 index 0000000000000000000000000000000000000000..8dffce5058636b451bbc83eb015b802486eee08b --- /dev/null +++ b/backport-avoid-infinite-loop-on-allocation-failure-in.patch @@ -0,0 +1,69 @@ +From 614d99eba149d0fafc64dfdddc7ef04970e0d86c Mon Sep 17 00:00:00 2001 +From: Michael Brown +Date: Tue, 20 Apr 2021 13:28:57 +0100 +Subject: [PATCH] [xen] Avoid infinite loop on allocation failure in + xenstore_response() +Signed-off-by: Michael Brown +Conflict:NA +Reference:https://github.com/ipxe/ipxe/commit/614d99eba149d0fafc64dfdddc7ef04970e0d86c +--- + src/interface/xen/xenstore.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) +diff --git a/src/interface/xen/xenstore.c b/src/interface/xen/xenstore.c +index a14881f..c2da532 100644 +--- a/src/interface/xen/xenstore.c ++++ b/src/interface/xen/xenstore.c +@@ -68,14 +68,14 @@ static void xenstore_send ( struct xen_hypervisor *xen, const void *data, + XENSTORE_RING_IDX cons; + XENSTORE_RING_IDX idx; + const char *bytes = data; +- size_t offset = 0; ++ size_t offset; + size_t fill; + + DBGCP ( intf, "XENSTORE raw request:\n" ); + DBGCP_HDA ( intf, MASK_XENSTORE_IDX ( prod ), data, len ); + + /* Write one byte at a time */ +- while ( offset < len ) { ++ for ( offset =0 ; offset < len ; offset++ ) { + + /* Wait for space to become available */ + while ( 1 ) { +@@ -90,7 +90,7 @@ static void xenstore_send ( struct xen_hypervisor *xen, const void *data, + + /* Write byte */ + idx = MASK_XENSTORE_IDX ( prod++ ); +- writeb ( bytes[offset++], &intf->req[idx] ); ++ writeb ( bytes[offset], &intf->req[idx] ); + } + + /* Update producer counter */ +@@ -125,13 +125,13 @@ static void xenstore_recv ( struct xen_hypervisor *xen, void *data, + XENSTORE_RING_IDX prod; + XENSTORE_RING_IDX idx; + char *bytes = data; +- size_t offset = 0; ++ size_t offset; + size_t fill; + + DBGCP ( intf, "XENSTORE raw response:\n" ); + + /* Read one byte at a time */ +- while ( offset < len ) { ++ for ( offset = 0 ; offset < len ; offset++ ) { + + /* Wait for data to be ready */ + while ( 1 ) { +@@ -147,7 +147,7 @@ static void xenstore_recv ( struct xen_hypervisor *xen, void *data, + /* Read byte */ + idx = MASK_XENSTORE_IDX ( cons++ ); + if ( data ) +- bytes[offset++] = readb ( &intf->rsp[idx] ); ++ bytes[offset] = readb ( &intf->rsp[idx] ); + } + if ( data ) + DBGCP_HDA ( intf, MASK_XENSTORE_IDX ( cons - len ), data, len ); +-- +2.23.0 + diff --git a/ipxe.spec b/ipxe.spec index 6ac933652b8bcd3df2f2f014d8934dca0dc274f9..11d9fa98ae02b2a0abbad70699fccf6df40cc48c 100644 --- a/ipxe.spec +++ b/ipxe.spec @@ -5,7 +5,7 @@ Name: ipxe Version: 1.20.1 -Release: 2 +Release: 3 Summary: A network boot loader Epoch: 1 License: GPLv2 with additional permissions and BSD @@ -14,6 +14,9 @@ Source0: https://github.com/ipxe/ipxe/archive/v%{version}.tar.gz Patch0001: 0001-build-customize-configuration.patch Patch0002: 0002-Use-spec-compliant-timeouts.patch +Patch6000: backport-avoid-infinite-loop-on-allocation-failure-in.patch + + %ifarch %{buildarches} BuildRequires: perl-interpreter perl-Getopt-Long syslinux mtools genisoimage edk2-devel BuildRequires: xz-devel gcc binutils-devel @@ -167,6 +170,12 @@ done %endif %changelog +* Tue Jun 08 2021 wangkerong - 1:1.20.1-3 +- Type:bugfix +- Id:NA +- SUG:NA +- DESC: round community patch fix avoid infinite loop on allocation failure + * Thu Sep 03 2020 zhouyihang - 1:1.20.1-2 - Type:bugfix - Id:NA