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

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