From b6cd11abc8700986ccfa5a1f0db16f1372426ddc Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 6 Feb 2025 15:10:48 +0100 Subject: [PATCH] vfs: tolerate fs construction failures When trying to apply dynamic config updates to the VFS, don't rely on the assumption that one file-system instance exists for each XML node because a malconfigured file-system route may result in a skipped file-system construction. Print a diagnostic message instead. Encountered while working on issue #5445 --- repos/os/include/vfs/dir_file_system.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/repos/os/include/vfs/dir_file_system.h b/repos/os/include/vfs/dir_file_system.h index a3849807f8..f4ce033265 100644 --- a/repos/os/include/vfs/dir_file_system.h +++ b/repos/os/include/vfs/dir_file_system.h @@ -872,10 +872,15 @@ class Vfs::Dir_file_system : public File_system for (unsigned i = 0; i < node.num_sub_nodes(); i++, curr = curr->next) { Xml_node const &sub_node = node.sub_node(i); + if (!curr) { + error("VFS config update missed file system for ", sub_node); + return; + } + /* check if type of XML node matches current file-system type */ - if (sub_node.has_type(curr->type()) == false) { - Genode::error("VFS config update failed (node type '", - sub_node.type(), "' != fs type '", curr->type(),"')"); + if (!curr || sub_node.has_type(curr->type()) == false) { + error("VFS config update failed (node type '", + sub_node.type(), "' != fs type '", curr->type(),"')"); return; }