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

GUIDINGLI 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 fc596936f3c fs/nfs: return ENOMEM when RPC client allocation fails
fc596936f3c is described below

commit fc596936f3ce8ea1a1a8c93a0f8126df6313687f
Author: jingfei <[email protected]>
AuthorDate: Thu Nov 26 00:29:13 2026 +0800

    fs/nfs: return ENOMEM when RPC client allocation fails
    
    nfs_bind() initializes ret to zero. If allocating the RPC client
    fails, the cleanup path frees the mount state but returns success.
    The VFS can then install a mountpoint with a NULL private handle.
    
    Set ret to -ENOMEM before cleanup so mount() reports the allocation
    failure and leaves no mountpoint behind.
    
    Signed-off-by: jingfei <[email protected]>
---
 fs/nfs/nfs_vfsops.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/nfs/nfs_vfsops.c b/fs/nfs/nfs_vfsops.c
index 2b6cb4fbe7a..cb58a8d9b81 100644
--- a/fs/nfs/nfs_vfsops.c
+++ b/fs/nfs/nfs_vfsops.c
@@ -2190,6 +2190,7 @@ static int nfs_bind(FAR struct inode *blkdriver, FAR 
const void *data,
   if (!rpc)
     {
       ferr("ERROR: Failed to allocate rpc structure\n");
+      ret = -ENOMEM;
       goto bad;
     }
 

Reply via email to