From: kosmirror <kos...@us...> - 2025-05-20 16:37:53
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 47c712a850c37337babfe6004d2ac37483f8f29c (commit) from 357ae137e9098d64eb6e6b874a92abf27548436a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 47c712a850c37337babfe6004d2ac37483f8f29c Author: QuzarDC <qu...@co...> Date: Sun May 18 00:05:25 2025 -0400 Fix use-after-free in `fs_close`. Seems this was added in #634 with the notion of clearing out the readdir index tracking on file close. The problem is that the only time it would apply is when there are 0 references, which means the file handle has already been freed based on the behavior of `fs_hnd_unref`. ----------------------------------------------------------------------- Summary of changes: kernel/fs/fs.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/kernel/fs/fs.c b/kernel/fs/fs.c index f7cb5c56..ce5ffef6 100644 --- a/kernel/fs/fs.c +++ b/kernel/fs/fs.c @@ -340,10 +340,6 @@ int fs_close(file_t fd) { /* Deref it and remove it from our table */ retval = fs_hnd_unref(h); - /* Reset our position */ - if(h->refcnt == 0) - h->idx = 0; - fd_table[fd] = NULL; return retval ? -1 : 0; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |