svn commit: r338219 - head/stand/fdt

Kyle Evans kevans at FreeBSD.org
Thu Aug 23 01:22:14 UTC 2018


Author: kevans
Date: Thu Aug 23 01:22:13 2018
New Revision: 338219
URL: https://svnweb.freebsd.org/changeset/base/338219

Log:
  fdt_fixups: relocate the /chosen node after applying fixups
  
  As indicated by the comment, any fixups applied (which might include
  overlays) can invalidate the previously located node by adding nodes or
  setting/adding properties. The later fdt_setprop of fixup-applied property
  would then fail because of the bad/wrong node offset.
  
  This would have generally been harmless, but potentially caused multiple
  applications of fixups and caused a little bit of bloat.
  
  MFC after:	1 week

Modified:
  head/stand/fdt/fdt_loader_cmd.c

Modified: head/stand/fdt/fdt_loader_cmd.c
==============================================================================
--- head/stand/fdt/fdt_loader_cmd.c	Thu Aug 23 00:58:10 2018	(r338218)
+++ head/stand/fdt/fdt_loader_cmd.c	Thu Aug 23 01:22:13 2018	(r338219)
@@ -933,6 +933,12 @@ fdt_fixup(void)
 
 	fdt_platform_fixups();
 
+	/*
+	 * Re-fetch the /chosen subnode; our fixups may apply overlays or add
+	 * nodes/properties that invalidate the offset we grabbed or created
+	 * above, so we can no longer trust it.
+	 */
+	chosen = fdt_subnode_offset(fdtp, 0, "chosen");
 	fdt_setprop(fdtp, chosen, "fixup-applied", NULL, 0);
 	return (1);
 }


More information about the svn-src-head mailing list