]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
net/ip: Fix limit_time calculation in freeing old fragments
authorSakar Arora <Sakar.Arora@nxp.com>
Mon, 19 Sep 2016 19:31:17 +0000 (01:01 +0530)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Tue, 18 Oct 2016 17:26:42 +0000 (20:26 +0300)
limit_time underflows when current time is less than 90000ms.
This causes packet fragments received during this time, i.e.,
till 90000ms pass since timer init, to be rejected.

Hence, set it to 0 if its less than 90000.

Signed-off-by: Sakar Arora <Sakar.Arora@nxp.com>
grub-core/net/ip.c

index 8c56baaf7894e7551c817bf925c0ecfba9b54eaf..aba4f89087bc14b1fe28a77794dd6792beb0bf36 100644 (file)
@@ -363,7 +363,9 @@ static void
 free_old_fragments (void)
 {
   struct reassemble *rsm, **prev;
-  grub_uint64_t limit_time = grub_get_time_ms () - 90000;
+  grub_uint64_t limit_time = grub_get_time_ms ();
+
+  limit_time = (limit_time > 90000) ? limit_time - 90000 : 0;
 
   for (prev = &reassembles, rsm = *prev; rsm; rsm = *prev)
     if (rsm->last_time < limit_time)