@Abhishek Mishra I checked fs_fstat.c and you are right, The write
permission check uses ->read instead of ->write:

if (inode->u.i_ops->writev || inode->u.i_ops->read)  // should be ->write

It looks like a copy paste mistake from the read block above it.
Nice catch. Will you send a fix??


On Wed, Apr 15, 2026 at 8:15 PM Abhishek Mishra <
[email protected]> wrote:

> Hi all,
> I was going through the VFS layer recently as part of learning how NuttX
> handles file permissions bits and while reading through proxy_fstat() in
> fs_fstat.c. I noticed a small what looks like a small typo.
> In the block driver proxy path, the write permissions bits are gated on
> ->read instead of ->write:
>
> Around line 120 of fs_fstat()
> [image: image.png]
>
> Because of this, a driver implementing read but not write would
> incorrectly have its write bits set in the fstat() result. If there’s a
> reason for checking ->read here, I’d like to understand it. If it is a
> typo, I can send a small fix. Happy to be wrong and learn :)
> Thanks,
> Abhishek
>

Reply via email to