From de6ea5f43f18620795c8eebeaba56fc8874eb414 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 10 Jul 2018 17:46:59 -0400 Subject: [PATCH] vfs: Move volume->ops NULL check to just after call to mount(). As Rene pointed out on the mailing list, if this is NULL after the file system mount call occurs, then something has gone very wrong and we should treat it as an error. --- src/system/kernel/fs/vfs.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index 122107e598..3b3c6bb7a5 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -7497,7 +7497,7 @@ fs_mount(char* path, const char* device, const char* fsName, uint32 flags, status = mount->volume->file_system->mount(mount->volume, device, flags, args, &rootID); - if (status != 0) + if (status != B_OK || mount->volume->ops == NULL) goto err2; } else { status = path_to_vnode(path, true, &coveredNode, NULL, kernel); @@ -7523,7 +7523,7 @@ fs_mount(char* path, const char* device, const char* fsName, uint32 flags, while (volume) { status = volume->file_system->mount(volume, device, flags, args, &rootID); - if (status != B_OK) { + if (status != B_OK || volume->ops == NULL) { if (volume->sub_volume) goto err4; goto err3; @@ -7534,7 +7534,7 @@ fs_mount(char* path, const char* device, const char* fsName, uint32 flags, volume = mount->volume; while (volume) { - if (volume->ops != NULL && volume->ops->all_layers_mounted != NULL) + if (volume->ops->all_layers_mounted != NULL) volume->ops->all_layers_mounted(volume); volume = volume->super_volume; }