Blame SOURCES/0036-change-stop-condition-to-avoid-infinite-loops.patch

f731ee
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f731ee
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
f731ee
Date: Tue, 21 Jan 2014 10:49:39 -0200
f731ee
Subject: [PATCH] change stop condition to avoid infinite loops
f731ee
f731ee
In net/net.c there is a while (1) that only exits if there is a stop
f731ee
condition and more then 10 packages or if there is no package received.
f731ee
f731ee
If GRUB is idle and enter in this loop, the only condition to leave is
f731ee
if it doesn't have incoming packages. In a network with heavy traffic
f731ee
this never happens.
f731ee
---
f731ee
 grub-core/net/net.c |  2 +-
f731ee
 ChangeLog           | 12 ++++++++++++
f731ee
 2 files changed, 13 insertions(+), 1 deletion(-)
f731ee
f731ee
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
f731ee
index 0e57e93e821..56355f3c98c 100644
f731ee
--- a/grub-core/net/net.c
f731ee
+++ b/grub-core/net/net.c
f731ee
@@ -1453,7 +1453,7 @@ receive_packets (struct grub_net_card *card, int *stop_condition)
f731ee
 	}
f731ee
       card->opened = 1;
f731ee
     }
f731ee
-  while (1)
f731ee
+  while (received < 100)
f731ee
     {
f731ee
       /* Maybe should be better have a fixed number of packets for each card
f731ee
 	 and just mark them as used and not used.  */ 
f731ee
diff --git a/ChangeLog b/ChangeLog
f731ee
index 10abfe28f20..f69d8c7e042 100644
f731ee
--- a/ChangeLog
f731ee
+++ b/ChangeLog
f731ee
@@ -1,3 +1,15 @@
f731ee
+2014-01-21  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
f731ee
+
f731ee
+	* grub-core/net/net.c (receive_packets): Change stop condition to avoid
f731ee
+	infinite loops.
f731ee
+
f731ee
+	In net/net.c there is a while (1) that only exits if there is a stop
f731ee
+	condition and more then 10 packages or if there is no package received.
f731ee
+
f731ee
+	If GRUB is idle and enter in this loop, the only condition to leave is
f731ee
+	if it doesn't have incoming packages. In a network with heavy traffic
f731ee
+	this never happens.
f731ee
+
f731ee
 2014-01-19  Colin Watson  <cjwatson@ubuntu.com>
f731ee
 
f731ee
 	* grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Ignore