提交 ce23447f 编写于 作者: J Jaegeuk Kim

f2fs: fix to cover io->bio with io_rwsem

In the f2fs_wait_on_page_writeback, io->bio should be covered by io_rwsem.
Otherwise, the bio pointer can become a dangling pointer due to data races.
Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
上级 d54c795b
...@@ -1049,15 +1049,14 @@ static inline bool is_merged_page(struct f2fs_sb_info *sbi, ...@@ -1049,15 +1049,14 @@ static inline bool is_merged_page(struct f2fs_sb_info *sbi,
{ {
enum page_type btype = PAGE_TYPE_OF_BIO(type); enum page_type btype = PAGE_TYPE_OF_BIO(type);
struct f2fs_bio_info *io = &sbi->write_io[btype]; struct f2fs_bio_info *io = &sbi->write_io[btype];
struct bio *bio = io->bio;
struct bio_vec *bvec; struct bio_vec *bvec;
int i; int i;
down_read(&io->io_rwsem); down_read(&io->io_rwsem);
if (!bio) if (!io->bio)
goto out; goto out;
bio_for_each_segment_all(bvec, bio, i) { bio_for_each_segment_all(bvec, io->bio, i) {
if (page == bvec->bv_page) { if (page == bvec->bv_page) {
up_read(&io->io_rwsem); up_read(&io->io_rwsem);
return true; return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册