Unverified Commit 70c98c7d authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!5004 nilfs2: fix potential use after free in nilfs_gccache_submit_read_data()

parents 6bb06684 a5378097
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -73,11 +73,9 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
		struct the_nilfs *nilfs = inode->i_sb->s_fs_info;

		err = nilfs_dat_translate(nilfs->ns_dat, vbn, &pbn);
		if (unlikely(err)) { /* -EIO, -ENOMEM, -ENOENT */
			brelse(bh);
		if (unlikely(err)) /* -EIO, -ENOMEM, -ENOENT */
			goto failed;
	}
	}

	lock_buffer(bh);
	if (buffer_uptodate(bh)) {
@@ -102,6 +100,8 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
 failed:
	unlock_page(bh->b_page);
	put_page(bh->b_page);
	if (unlikely(err))
		brelse(bh);
	return err;
}