Commit 028288df authored by Zhiqiang Liu's avatar Zhiqiang Liu Committed by Song Liu

md: raid1: check rdev before reference in raid1_sync_request func

In raid1_sync_request func, rdev should be checked before reference.
Signed-off-by: default avatarZhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
parent a7ede3d1
...@@ -2782,7 +2782,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr, ...@@ -2782,7 +2782,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
write_targets++; write_targets++;
} }
} }
if (bio->bi_end_io) { if (rdev && bio->bi_end_io) {
atomic_inc(&rdev->nr_pending); atomic_inc(&rdev->nr_pending);
bio->bi_iter.bi_sector = sector_nr + rdev->data_offset; bio->bi_iter.bi_sector = sector_nr + rdev->data_offset;
bio_set_dev(bio, rdev->bdev); bio_set_dev(bio, rdev->bdev);
......
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