ext4: avoid buffer leak in ext4_orphan_add() after prior errors
authorVasily Averin <[email protected]>
Tue, 6 Nov 2018 22:01:36 +0000 (17:01 -0500)
committerTheodore Ts'o <[email protected]>
Tue, 6 Nov 2018 22:01:36 +0000 (17:01 -0500)
Fixes: d745a8c20c1f ("ext4: reduce contention on s_orphan_lock")
Fixes: 6e3617e579e0 ("ext4: Handle non empty on-disk orphan link")
Cc: Dmitry Monakhov <[email protected]>
Signed-off-by: Vasily Averin <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
Cc: [email protected] # 2.6.34
fs/ext4/namei.c

index 67a38532032ae89cfcbaec35fe139992cbf2875e..d388cce72db201c48c22f4247a0f902e9b79ae1c 100644 (file)
@@ -2811,7 +2811,9 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)
                        list_del_init(&EXT4_I(inode)->i_orphan);
                        mutex_unlock(&sbi->s_orphan_lock);
                }
-       }
+       } else
+               brelse(iloc.bh);
+
        jbd_debug(4, "superblock will point to %lu\n", inode->i_ino);
        jbd_debug(4, "orphan inode %lu will point to %d\n",
                        inode->i_ino, NEXT_ORPHAN(inode));