public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* fconfig patch
@ 2008-11-20 21:27 Bart Veer
  0 siblings, 0 replies; only message in thread
From: Bart Veer @ 2008-11-20 21:27 UTC (permalink / raw)
  To: ecos-patches

When running a new RedBoot on a board which had a very old RedBoot
installed, I ran into a problem with the old fconfig data. The new
RedBoot was looking for an option that did not exist in the old data.
At some point an incompatibility must have been introduced because the
new RedBoot went into an infinite loop. This patch ensures that the
loop will always move forwards through the fconfig data, preventing
the infinite loop.

Bart

2008-11-20  Bart Veer  <bartv@ecoscentric.com>

	* src/fconfig.c (flash_lookup_config): add a sanity check to
	reduce the risk of RedBoot going into an infinite loop.

Index: src/fconfig.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/fconfig.c,v
retrieving revision 1.15
diff -u -p -r1.15 fconfig.c
--- src/fconfig.c	18 Nov 2008 01:28:12 -0000	1.15
+++ src/fconfig.c	20 Nov 2008 21:19:02 -0000
@@ -838,6 +838,11 @@ flash_lookup_config(char *key)
         if (strcmp(key, CONFIG_OBJECT_KEY(dp)) == 0) {
             return dp;
         }
+        // Sanity check to prevent RedBoot going into an infinite loop when
+        // there is something dodgy in the fconfig area.
+        if (len <= 0) {
+            break;
+        }
         dp += len;
     }
 //    diag_printf("Can't find config data for '%s'\n", key);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-20 21:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-20 21:27 fconfig patch Bart Veer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).