From 8221c2da64a1325fbff3ef829183de2dfd230de7 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 22 Sep 2016 08:22:28 -0600 Subject: [PATCH] Corrects a bad assertion noted by Pierre-noel Bouteville. Also fixes a reference counting problem in an error condition: When the mountpoint inode is found but is not an appropriate mountpoint, the reference count on the inode was not being decremented. --- fs/mount/fs_mount.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/mount/fs_mount.c b/fs/mount/fs_mount.c index 04e7bc3a9e..48c4a36f08 100644 --- a/fs/mount/fs_mount.c +++ b/fs/mount/fs_mount.c @@ -283,22 +283,19 @@ int mount(FAR const char *source, FAR const char *target, mountpt_inode = inode_find(target, NULL); if (mountpt_inode != NULL) { - /* Yes... Is is a directory node (i.e., not a driver or other special - * node. + /* Successfully found. The reference count on the inode has been + * incremented. + * + * But is it a directory node (i.e., not a driver or other special + * node). */ if (INODE_IS_SPECIAL(mountpt_inode)) { - ferr("ERROR: target %s exists and is a special nodes\n", target); + ferr("ERROR: target %s exists and is a special node\n", target); errcode = -ENOTDIR; - goto errout_with_semaphore; + goto errout_with_inode; } - - /* Successfully found. The reference count on the inode has been - * incremented. - */ - - DEBUGASSERT(mountpt_inode->u.i_mops != NULL); } else #endif @@ -422,6 +419,9 @@ errout_with_mountpt: } #endif +#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS +errout_with_inode: +#endif inode_release(mountpt_inode); goto errout;