dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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