Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock opened file inodes to prevent a use after free race condition #415

Merged
merged 3 commits into from
Aug 27, 2024

Conversation

Ciaxur
Copy link
Contributor

@Ciaxur Ciaxur commented Jul 14, 2024

Relates to: #414

There's a race condition where the opened file handlers are getting closed by the Flush operation:

f.content.Close(id)

This PR moves the existed inode lock prior to opening the file descriptor and wraps the same inode lock around the fd closure, which prevents the mentioned bug, and handles/reports the un-handled error.

@jstaf
Copy link
Owner

jstaf commented Aug 27, 2024

Looks great after reviewing! Thanks for your PR, I'll close your associated issue. 🙂

@jstaf jstaf merged commit e163a43 into jstaf:master Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants