nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone
28f7f8
From 0000000000000000000000000000000000000000 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
28f7f8
Subject: [PATCH] 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
 grub-core/net/net.c |  2 +-
28f7f8
 ChangeLog           | 12 ++++++++++++
606ea6
 2 files changed, 13 insertions(+), 1 deletion(-)
606ea6
28f7f8
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
28f7f8
index 0e57e93e821..56355f3c98c 100644
28f7f8
--- a/grub-core/net/net.c
28f7f8
+++ b/grub-core/net/net.c
28f7f8
@@ -1453,7 +1453,7 @@ receive_packets (struct grub_net_card *card, int *stop_condition)
28f7f8
 	}
28f7f8
       card->opened = 1;
28f7f8
     }
28f7f8
-  while (1)
28f7f8
+  while (received < 100)
28f7f8
     {
28f7f8
       /* Maybe should be better have a fixed number of packets for each card
28f7f8
 	 and just mark them as used and not used.  */ 
39700a
diff --git a/ChangeLog b/ChangeLog
28f7f8
index 10abfe28f20..f69d8c7e042 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