Skip to content

fs/vfs/fs_fstat.c: fix write capability check in proxy_fstat()#18746

Merged
michallenc merged 1 commit intoapache:masterfrom
Abhishek-2808:fix-fstat-write-check
Apr 16, 2026
Merged

fs/vfs/fs_fstat.c: fix write capability check in proxy_fstat()#18746
michallenc merged 1 commit intoapache:masterfrom
Abhishek-2808:fix-fstat-write-check

Conversation

@Abhishek-2808
Copy link
Copy Markdown

In proxy_fstat(), when detecting a block driver proxy , the condition that sets the write permission bits (S_IWOTH | S_IWGRP | S_IWUSR) in the fstat() result incorrectly checked i_ops->read instead of i_ops->write. As a result, any block driver proxy that implements read but not write would be incorrectly reported as writable by fstat()

This is a one-line fix with no behavioural change for any driver that implements both read and write (the common case). Only drivers that implement read but not write are affected, and for them the fix corrects a wrong permission report.

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>
@github-actions github-actions bot added Area: File System File System issues Size: XS The size of the change in this PR is very small labels Apr 15, 2026
@michallenc michallenc merged commit 5c9de46 into apache:master Apr 16, 2026
41 checks passed
@Abhishek-2808 Abhishek-2808 deleted the fix-fstat-write-check branch April 16, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: File System File System issues Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants