Commit 5808b14a authored by Russell King's avatar Russell King Committed by Al Viro

fs/adfs: super: fix use-after-free bug

Fix a use-after-free bug during filesystem initialisation, where we
access the disc record (which is stored in a buffer) after we have
released the buffer.
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 4c5762f5
...@@ -378,6 +378,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -378,6 +378,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
struct buffer_head *bh; struct buffer_head *bh;
struct object_info root_obj; struct object_info root_obj;
unsigned char *b_data; unsigned char *b_data;
unsigned int blocksize;
struct adfs_sb_info *asb; struct adfs_sb_info *asb;
struct inode *root; struct inode *root;
int ret = -EINVAL; int ret = -EINVAL;
...@@ -423,8 +424,10 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -423,8 +424,10 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
goto error_badfs; goto error_badfs;
} }
blocksize = 1 << dr->log2secsize;
brelse(bh); brelse(bh);
if (sb_set_blocksize(sb, 1 << dr->log2secsize)) {
if (sb_set_blocksize(sb, blocksize)) {
bh = sb_bread(sb, ADFS_DISCRECORD / sb->s_blocksize); bh = sb_bread(sb, ADFS_DISCRECORD / sb->s_blocksize);
if (!bh) { if (!bh) {
adfs_msg(sb, KERN_ERR, adfs_msg(sb, KERN_ERR,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment