From b9b9d6dbaf2844308233deb1b33755023c5692cd Mon Sep 17 00:00:00 2001 From: chenjing Date: Fri, 16 Apr 2021 11:39:37 +0800 Subject: [PATCH] Description: [fix] LFN dir entry leak Bug: #I3J1IC Test: io test 1000 time --- fs/fat/os_adapt/fatfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/fat/os_adapt/fatfs.c b/fs/fat/os_adapt/fatfs.c index a8aba58c..a8aa1047 100755 --- a/fs/fat/os_adapt/fatfs.c +++ b/fs/fat/os_adapt/fatfs.c @@ -399,6 +399,7 @@ int fatfs_create(struct Vnode *parent, const char *name, int mode, struct Vnode ret = fatfs_2_vfs(result); goto ERROR_UNLOCK; } + dp->blk_ofs = dir_ofs(dp); get_fileinfo(dp, finfo); dp->obj.objsize = 0; @@ -1539,6 +1540,7 @@ int fatfs_rename(struct Vnode *old_vnode, struct Vnode *new_parent, const char * if (result != FR_OK) { goto ERROR_FREE; } + dp_new->blk_ofs = dir_ofs(dp_new); get_fileinfo(dp_new, finfo_new); dfp_new->fno.fp_list.pstNext = dfp_old->fno.fp_list.pstNext; @@ -1770,6 +1772,7 @@ int fatfs_mkdir(struct Vnode *parent, const char *name, mode_t mode, struct Vnod if (result != FR_OK) { goto ERROR_REMOVE_CHAIN; } + dfp_new->f_dir.blk_ofs = dir_ofs(&(dfp_new->f_dir)); get_fileinfo(&(dfp_new->f_dir), &(dfp_new->fno)); ret = VnodeAlloc(&fatfs_vops, &vp); -- GitLab