hi!

on the routerstation-pro the mtd command of the sysupgrade script 
(ar71xx/base-files/lib/upgrade/platform.sh) sometimes fails because of 
problems with the FIS table. this sometimes results in a segfault, sometimes 
in an error message. i see this about every third time i try to flash an 
image.

i tracked it down to these lines in mtd fis.c, both in fis_validate() and 
fis_remap():

  if (!desc->hdr.name[0] || (desc->hdr.name[0] == 0xff))
        break;

when the problem happens, desc->hdr.name[0] is zero, and we break out early 
from the loop, causing other things to be uninitialized.

in the case of fis_validate() this returns the error "Failed to validate the 
new FIS partition table", later. but in fis_remap() the uninitialized (NULL) 
pointers 'first' and 'last' are accessed later, causing the segfault. 
obviously the segfault could and should be avoided by adding something like 
the following lines to fis_remap():

  if (!first || !last)
      return -1;

but the real problem must be somewhere else. and this is where i am stuck 
now... i wonder why we only sometimes get a 0 for desc->hdr.name[0]? can it be 
a problem with the flash driver for the ar71xx?

bruno

ps: i'm not the only one seeing this problem: 
https://forum.openwrt.org/viewtopic.php?id=24188
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to