This is an automated email from the ASF dual-hosted git repository.

michallenc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 5c9de46c79f fs/vfs/fs_fstat.c: fix write capability check in 
proxy_fstat()
5c9de46c79f is described below

commit 5c9de46c79f7782aeebe9286c4a09f561205f732
Author: Abhishek Mishra <[email protected]>
AuthorDate: Wed Apr 15 17:03:08 2026 +0000

    fs/vfs/fs_fstat.c: fix write capability check in proxy_fstat()
    
    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 <[email protected]>
---
 fs/vfs/fs_fstat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/vfs/fs_fstat.c b/fs/vfs/fs_fstat.c
index a1cd801a994..1e8d7c127bc 100644
--- a/fs/vfs/fs_fstat.c
+++ b/fs/vfs/fs_fstat.c
@@ -117,7 +117,7 @@ static int proxy_fstat(FAR struct file *filep, FAR struct 
inode *inode,
               buf->st_mode |= S_IROTH | S_IRGRP | S_IRUSR;
             }
 
-          if (inode->u.i_ops->writev || inode->u.i_ops->read)
+          if (inode->u.i_ops->writev || inode->u.i_ops->write)
             {
               buf->st_mode |= S_IWOTH | S_IWGRP | S_IWUSR;
             }

Reply via email to