mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 23:18:21 +00:00
vmmcache: fix TOCTOU
This commit is contained in:
@@ -369,10 +369,15 @@ int vmmcache_syncvnode(vnode_t *vnode, uintmax_t offset, size_t size) {
|
|||||||
vnodedirtylist = vnodedirtylist->writenext;
|
vnodedirtylist = vnodedirtylist->writenext;
|
||||||
page->writenext = NULL;
|
page->writenext = NULL;
|
||||||
|
|
||||||
int error = syncpage(page, false);
|
// another thread could already have synced this page, verify if it is still dirty
|
||||||
|
if (page->flags & PAGE_FLAGS_DIRTY) {
|
||||||
|
int error = syncpage(page, false);
|
||||||
|
|
||||||
if (e == 0)
|
if (e == 0)
|
||||||
e = error;
|
e = error;
|
||||||
|
} else {
|
||||||
|
RELEASE_LOCK();
|
||||||
|
}
|
||||||
// syncpage returns with lock released
|
// syncpage returns with lock released
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user