summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-15 12:59:05 -0400
committerIan Moffett <ian@osmora.org>2025-10-15 12:59:05 -0400
commit0cf3ec7ad8dae5ff969cd849d58de1e1a7bfe6d0 (patch)
tree6024ea1d410ce557b789a5edffb48a56b84290b0
parent3b3c96b9c9b78ea1afb71b30a2a6562bfb461e63 (diff)
kern: namei: Return vnode before exiting function
If there is a file that is found, we want to return the result before we return from the function, fixes issue with uninitialized vnodes on lookups Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--src/sys/os/vfs_namei.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/sys/os/vfs_namei.c b/src/sys/os/vfs_namei.c
index e541611..1425c30 100644
--- a/src/sys/os/vfs_namei.c
+++ b/src/sys/os/vfs_namei.c
@@ -90,14 +90,15 @@ namei(struct nameidata *ndp)
lookup.dirvp = mp->vp;
lookup.vpp = &vp;
- /* If it was found, return */
- error = vops->lookup(&lookup);
- if (error == 0)
- return 0;
-
/* Return the result */
- if (ndp->vp_res != NULL)
+ error = vops->lookup(&lookup);
+ if (error == 0 && ndp->vp_res != NULL) {
*ndp->vp_res = vp;
+ }
+
+ if (error == 0) {
+ return 0;
+ }
}
printf("namei: f: %s\n", ndp->path);