dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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