forked from cloudius-systems/osv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There is a race window between f_count reaches 0 and we set f_count to INT_MIN. This race would result in multiple call to fp->close() and rcu_dispose(fp) if we call them in fdrop(). To fix, we move fp->stop_polls and fp->close() from fdrop() into in fdset() and fdclose(). This will eliminate the multipe call to fp->close(), as there can be only one call to fdclose() or fdset(). Also, we set f_count to INT_MIN using CAS, this way, we make sure rcu_dispose(fp) won't be called twice. Fixes cloudius-systems#293. Signed-off-by: Asias He <[email protected]>
- Loading branch information
Showing
5 changed files
with
31 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,6 @@ int vfs_file::close() | |
if (error) | ||
return error; | ||
|
||
fp->f_dentry.reset(); | ||
return 0; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters