summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2017-06-23 19:19:49 +0300
committerShaohua Li <shli@fb.com>2017-06-23 19:19:49 +0300
commit7f053a6a745557b3f3ad63e9d28ba85c3c0b1563 (patch)
treec327f5b839802de518d105d52783c1ec30dd6a86 /drivers/md
parent5a85071c2cbcc7d8d8f764b33bf64c76e47d268d (diff)
downloadlinux-7f053a6a745557b3f3ad63e9d28ba85c3c0b1563.tar.xz
MD: fix a null dereference
rdev->mddev could be null in start time. Reported-by: Ming Lei <ming.lei@redhat.com> Fix: 5a85071c2cbc(md: use a separate bio_set for synchronous IO.) Cc: NeilBrown <neilb@suse.com> Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 65ad837aeb54..092b48f8095e 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -205,7 +205,7 @@ EXPORT_SYMBOL_GPL(bio_alloc_mddev);
static struct bio *md_bio_alloc_sync(struct mddev *mddev)
{
- if (!mddev->sync_set)
+ if (!mddev || !mddev->sync_set)
return bio_alloc(GFP_NOIO, 1);
return bio_alloc_bioset(GFP_NOIO, 1, mddev->sync_set);