]> git.itanic.dy.fi Git - linux-stable/commitdiff
isofs: release buffer head before return
authorPan Bian <bianpan2016@163.com>
Mon, 18 Jan 2021 12:04:55 +0000 (04:04 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Mar 2021 16:44:37 +0000 (17:44 +0100)
[ Upstream commit 0a6dc67a6aa45f19bd4ff89b4f468fc50c4b8daa ]

Release the buffer_head before returning error code in
do_isofs_readdir() and isofs_find_entry().

Fixes: 2deb1acc653c ("isofs: fix access to unallocated memory when reading corrupted filesystem")
Link: https://lore.kernel.org/r/20210118120455.118955-1-bianpan2016@163.com
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/isofs/dir.c
fs/isofs/namei.c

index e7599615e4e0469bbf420cc9804ce47e3d001f0e..e876a30f90735cb5643013d8415f45fff96dd770 100644 (file)
@@ -151,6 +151,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *file,
                        printk(KERN_NOTICE "iso9660: Corrupted directory entry"
                               " in block %lu of inode %lu\n", block,
                               inode->i_ino);
+                       brelse(bh);
                        return -EIO;
                }
 
index aee592767f1d0bd6301b22c1a46bf1e37312e575..2c43de1b034d27c1ed9e1e50a3b79328c3f2b309 100644 (file)
@@ -101,6 +101,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
                        printk(KERN_NOTICE "iso9660: Corrupted directory entry"
                               " in block %lu of inode %lu\n", block,
                               dir->i_ino);
+                       brelse(bh);
                        return 0;
                }