summaryrefslogtreecommitdiff
path: root/components/dfs/src/dfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'components/dfs/src/dfs.c')
-rw-r--r--components/dfs/src/dfs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c
index 86ef809fbf..fe0020b277 100644
--- a/components/dfs/src/dfs.c
+++ b/components/dfs/src/dfs.c
@@ -153,6 +153,13 @@ struct dfs_fd *fd_get(int fd)
dfs_lock();
d = &fd_table[fd];
+ /* check dfs_fd valid or not */
+ if (d->path == RT_NULL || d->fs == RT_NULL)
+ {
+ dfs_unlock();
+ return RT_NULL;
+ }
+
/* increase the reference count */
d->ref_count ++;
dfs_unlock();