Skip to content

Commit c6815bb

Browse files
Donny9xiaoxiang781216
authored andcommitted
fs/mount: move inode_lock to before bind to avoid deadlock(nsh and rptun)
Signed-off-by: dongjiuzhu1 <[email protected]>
1 parent b733030 commit c6815bb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/mount/fs_mount.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ int nx_mount(FAR const char *source, FAR const char *target,
298298
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
299299
struct inode_search_s desc;
300300
#endif
301-
void *fshandle = NULL;
301+
FAR void *fshandle = NULL;
302302
int ret;
303303

304304
/* Verify required pointer arguments */
@@ -442,13 +442,16 @@ int nx_mount(FAR const char *source, FAR const char *target,
442442
}
443443
#endif
444444

445+
inode_unlock();
446+
445447
/* On failure, the bind method returns -errorcode */
446448

447449
#if defined(BDFS_SUPPORT) || defined(MDFS_SUPPORT)
448450
ret = mops->bind(drvr_inode, data, &fshandle);
449451
#else
450452
ret = mops->bind(NULL, data, &fshandle);
451453
#endif
454+
DEBUGVERIFY(inode_lock() >= 0);
452455
if (ret < 0)
453456
{
454457
/* The inode is unhappy with the driver for some reason. Back out

0 commit comments

Comments
 (0)