From 3868b667cb5649e56fb1cfbd0754b5a6eaf945ed Mon Sep 17 00:00:00 2001 From: Matheus Date: Fri, 20 Sep 2024 18:58:29 -0300 Subject: [PATCH] open: fix use of possibly null variable --- kernel-src/sys/syscalls/open.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel-src/sys/syscalls/open.c b/kernel-src/sys/syscalls/open.c index 22798103..b8c52518 100644 --- a/kernel-src/sys/syscalls/open.c +++ b/kernel-src/sys/syscalls/open.c @@ -62,7 +62,9 @@ syscallret_t syscall_openat(context_t *context, int dirfd, char *path, int flags ret.errno = vfs_create(dirnode, pathbuf, &attr, V_TYPE_REGULAR, &vnode); if (ret.errno == EEXIST && (flags & O_EXCL) == 0) goto retry_open; - VOP_UNLOCK(vnode); + else if (ret.errno == 0) { + VOP_UNLOCK(vnode); + } } if (ret.errno)