From: Paulo Flabiano Smorigo Date: Tue, 21 Jan 2014 12:49:39 +0000 (-0200) Subject: change stop condition to avoid infinite loops X-Git-Tag: 2.02-beta3~687 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d99d2f84166b0f60673d5c0714605a153946c0fc;p=thirdparty%2Fgrub.git change stop condition to avoid infinite loops In net/net.c there is a while (1) that only exits if there is a stop condition and more then 10 packages or if there is no package received. If GRUB is idle and enter in this loop, the only condition to leave is if it doesn't have incoming packages. In a network with heavy traffic this never happens. --- diff --git a/ChangeLog b/ChangeLog index 10abfe28f..f69d8c7e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2014-01-21 Paulo Flabiano Smorigo + + * grub-core/net/net.c (receive_packets): Change stop condition to avoid + infinite loops. + + In net/net.c there is a while (1) that only exits if there is a stop + condition and more then 10 packages or if there is no package received. + + If GRUB is idle and enter in this loop, the only condition to leave is + if it doesn't have incoming packages. In a network with heavy traffic + this never happens. + 2014-01-19 Colin Watson * grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Ignore diff --git a/grub-core/net/net.c b/grub-core/net/net.c index 0e57e93e8..56355f3c9 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -1453,7 +1453,7 @@ receive_packets (struct grub_net_card *card, int *stop_condition) } card->opened = 1; } - while (1) + while (received < 100) { /* Maybe should be better have a fixed number of packets for each card and just mark them as used and not used. */