fs/vfs/fs_fstat.c: fix write capability check in proxy_fstat()#18746
Merged
michallenc merged 1 commit intoapache:masterfrom Apr 16, 2026
Merged
fs/vfs/fs_fstat.c: fix write capability check in proxy_fstat()#18746michallenc merged 1 commit intoapache:masterfrom
michallenc merged 1 commit intoapache:masterfrom
Conversation
In proxy_fstat(), the write permission bits for a block driver proxy were gated on `i_ops->read` instead of `i_ops->write`: The effect is that a driver implementing read but not write would have S_IWOTH | S_IWGRP | S_IWUSR incorrectly set in the fstat() result, reporting the file as writable when it is not. Fix: replace `->read` with `->write` in the write check condition. Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
xiaoxiang781216
approved these changes
Apr 16, 2026
simbit18
approved these changes
Apr 16, 2026
michallenc
approved these changes
Apr 16, 2026
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.
In
proxy_fstat(), when detecting a block driver proxy , the condition that sets the write permission bits(S_IWOTH | S_IWGRP | S_IWUSR)in thefstat() result incorrectly checkedi_ops->readinstead ofi_ops->write. As a result, any block driver proxy that implements read but not write would be incorrectly reported as writable byfstat()This is a one-line fix with no behavioural change for any driver that implements both
readandwrite(the common case). Only drivers that implementreadbut notwriteare affected, and for them the fix corrects a wrong permission report.