Conversation
Bug fixes: - bitmap.h: Return 0 instead of -EIO on sb_bread failure (type mismatch) Also restore bitmap and block count on allocation failure - inode.c: Fix buffer leak in simplefs_lookup() - release bh on error - inode.c: Initialize fi variable and use explicit indices in simplefs_set_file_into_dir() to prevent undefined behavior - inode.c: Add null termination after strncpy for filenames - inode.c: Add bounds validation for extent avail index in simplefs_create(), simplefs_link(), and simplefs_symlink() - inode.c: Add missing extent nr_files increment in link/symlink In addition, this commit adds Linux 6.15+ compatibility. - Update write_begin() signature (kiocb-based API) - Update write_end() signature and file reference access - Conditionally exclude writepage from aops (deprecated) - Update simplefs_mkdir() to return 'struct dentry *'
c69ad94 to
aaf82c8
Compare
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="inode.c">
<violation number="1" location="inode.c:1030">
Returning -EMLINK via the new `avail >= SIMPLEFS_MAX_EXTENTS` branch leaks the inode allocated by `simplefs_new_inode()` because the `goto end` path never frees the inode or its block.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| /* Validate avail index is within bounds */ | ||
| if (avail >= SIMPLEFS_MAX_EXTENTS) { | ||
| ret = -EMLINK; | ||
| goto end; |
There was a problem hiding this comment.
Returning -EMLINK via the new avail >= SIMPLEFS_MAX_EXTENTS branch leaks the inode allocated by simplefs_new_inode() because the goto end path never frees the inode or its block.
Prompt for AI agents
Address the following comment on inode.c at line 1030:
<comment>Returning -EMLINK via the new `avail >= SIMPLEFS_MAX_EXTENTS` branch leaks the inode allocated by `simplefs_new_inode()` because the `goto end` path never frees the inode or its block.</comment>
<file context>
@@ -1003,6 +1024,12 @@ static int simplefs_link(struct dentry *old_dentry,
+ /* Validate avail index is within bounds */
+ if (avail >= SIMPLEFS_MAX_EXTENTS) {
+ ret = -EMLINK;
+ goto end;
+ }
+
</file context>
aaf82c8 to
fe5f56b
Compare
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.
Bug fixes:
In addition, this commit adds Linux 6.15+ compatibility.
Summary by cubic
Fixes high-severity SimpleFS bugs that could leak buffers, corrupt directory entries, or mis-handle block allocation. Adds Linux 6.15+ compatibility for write paths and mkdir to keep builds green and runtime stable.
Bug Fixes
Compatibility
Written for commit fe5f56b. Summary will update automatically on new commits.