From 20504d801faf231445bd1dc8ee5a55cfef88009f Mon Sep 17 00:00:00 2001 From: "lijng.ly" Date: Sat, 1 Nov 2025 09:43:18 +0800 Subject: [PATCH] fs/rpmsgfs: Add handling for errors returned by rpmsgfs_client_stat This commit addresses an issue of multiple invalid loops in the rpmsgfs_mkpath function under specific cross-system mount scenarios. Problem Description: When performing directory access restriction on the Linux side, users execute the mount command in the NuttX shell:mount -t rpmsgfs -o cpu=server,fs=/root/demo/fold /nuttx_foldThe Linux side restricts NuttX from accessing directories outside /root/demo/fold and returns a permission deny error (or other negative return codes). However, the existing code in rpmsgfs_mkpath only handles the case where rpmsgfs_client_stat returns ret = 0, and lacks processing logic for negative return values. This omission causes the while loop in rpmsgfs_mkpath to run indefinitely. Solution Implemented: Added error handling for negative return values of rpmsgfs_client_stat in rpmsgfs_mkpath. When rpmsgfs_client_stat returns a value < 0, the function will break out of the while loop. Signed-off-by: Lijing lijing.ly@bytedance.com --- fs/rpmsgfs/rpmsgfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/rpmsgfs/rpmsgfs.c b/fs/rpmsgfs/rpmsgfs.c index 733e67e3516a0..cdd5b1c4c71b9 100644 --- a/fs/rpmsgfs/rpmsgfs.c +++ b/fs/rpmsgfs/rpmsgfs.c @@ -262,7 +262,7 @@ static void rpmsgfs_mkpath(FAR struct rpmsgfs_mountpt_s *fs, int ret; ret = rpmsgfs_client_stat(fs->handle, fs->fs_root, &buf); - if (ret == 0) + if (ret <= 0) { break; }