diff options
author | Zhiqiang Liu <liuzhiqiang26@huawei.com> | 2019-12-10 03:42:25 +0100 |
---|---|---|
committer | Song Liu <songliubraving@fb.com> | 2019-12-11 19:36:13 +0100 |
commit | 028288df635f5a9addd48ac4677b720192747944 (patch) | |
tree | 1086f52d3b22212ea32ffbe13d44e6cbbd76e148 /drivers/md/raid1.c | |
parent | raid5: need to set STRIPE_HANDLE for batch head (diff) | |
download | linux-028288df635f5a9addd48ac4677b720192747944.tar.xz linux-028288df635f5a9addd48ac4677b720192747944.zip |
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: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index a409ab6f30bc..201fd8aec59a 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2782,7 +2782,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr, write_targets++; } } - if (bio->bi_end_io) { + if (rdev && bio->bi_end_io) { atomic_inc(&rdev->nr_pending); bio->bi_iter.bi_sector = sector_nr + rdev->data_offset; bio_set_dev(bio, rdev->bdev); |