Repository navigation
nandpart: fix UAF when freeing mbr - #264
Merged
Merged
Conversation
apritzel
requested changes
Nov 4, 2026
apritzel
left a comment
Contributor
There was a problem hiding this comment.
Can you please extend the commit message a bit, and be it for spelling out "use after free", no need to use cryptic abbreviations, we want this readable and understandable by everybody.
Otherwise the whole code is not very elegant, so your solution is fine and looks correct.
Contributor
Author
|
Sorry, I should’ve done that from the start. Thanks for reviewing! |
Contributor
|
Thanks, that reads very good! Can you now please put this in the actual commit message, not just the PR description? And you would need your Signed-off-by: line, just like in Linux. |
The cleanup loop frees all mbrs entries, including the one referenced by mbr. This leaves mbr pointing to freed memory that is subsequently used to update and write the partition tables. Skip mbr in the initial cleanup and free it after writing or when the user cancels. Signed-off-by: r4v3n6101 <raven6107@gmail.com>
r4v3n6101
force-pushed
the
nand-uaf-fix
branch
from
November 4, 2026 16:06
7871502 to
3f0cef6
Compare
Contributor
Author
|
Made it! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The cleanup loop frees all mbrs entries, including the one referenced by
mbr. This leaves mbr pointing to freed memory that is subsequently used
to update and write the partition tables.
Skip mbr in the initial cleanup and free it after writing or when the
user cancels.