dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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