nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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