VFS: fix TOCTOU bug in sync
This commit is contained in:
parent
ed23a7a7d2
commit
14e470be81
1 changed files with 3 additions and 3 deletions
|
@ -299,13 +299,13 @@ int do_sync()
|
|||
int r = OK;
|
||||
|
||||
for (vmp = &vmnt[0]; vmp < &vmnt[NR_MNTS]; ++vmp) {
|
||||
if ((r = lock_vmnt(vmp, VMNT_EXCL)) != OK)
|
||||
break;
|
||||
if (vmp->m_dev != NO_DEV && vmp->m_fs_e != NONE &&
|
||||
vmp->m_root_node != NULL) {
|
||||
if ((r = lock_vmnt(vmp, VMNT_EXCL)) != OK)
|
||||
break;
|
||||
req_sync(vmp->m_fs_e);
|
||||
unlock_vmnt(vmp);
|
||||
}
|
||||
unlock_vmnt(vmp);
|
||||
}
|
||||
|
||||
return(r);
|
||||
|
|
Loading…
Reference in a new issue