affs_remove_link() gets a directory inode via affs_iget(). If affs_remove_hash() or affs_insert_hash() fails, it unlocks the directory and exits without dropping the inode reference. Call iput() on both error paths to fix the reference leaks. Signed-off-by: Haoxiang Li --- fs/affs/amigaffs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index affa20d2b73d..0c24ad2208fa 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c @@ -178,6 +178,7 @@ affs_remove_link(struct dentry *dentry) retval = affs_remove_hash(dir, link_bh); if (retval) { affs_unlock_dir(dir); + iput(dir); goto done; } mark_buffer_dirty(link_bh); @@ -186,6 +187,7 @@ affs_remove_link(struct dentry *dentry) retval = affs_insert_hash(dir, bh); if (retval) { affs_unlock_dir(dir); + iput(dir); goto done; } mark_buffer_dirty(bh); -- 2.25.1