[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1493200177-10699-1-git-send-email-os@iscas.ac.cn>
Date: Wed, 26 Apr 2017 02:49:37 -0700
From: Heloise <os@...as.ac.cn>
To: philipp.reisner@...bit.com, lars.ellenberg@...bit.com
Cc: drbd-dev@...ts.linbit.com, linux-kernel@...r.kernel.org,
Heloise <os@...as.ac.cn>
Subject: [PATCH] drbd:fix null pointer deref in _drbd_md_sync_page_io
The return value of bio_alloc_drbd can be NULL and is used without
validation, which may cause null-pointer dereference, fix it.
Signed-off-by: Heloise <os@...as.ac.cn>
---
drivers/block/drbd/drbd_actlog.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c
index 8d7bcfa..d6bb30e 100644
--- a/drivers/block/drbd/drbd_actlog.c
+++ b/drivers/block/drbd/drbd_actlog.c
@@ -151,6 +151,10 @@ static int _drbd_md_sync_page_io(struct drbd_device *device,
op_flags |= REQ_SYNC;
bio = bio_alloc_drbd(GFP_NOIO);
+ if (!bio) {
+ err = -ENOMEM;
+ return err;
+ }
bio->bi_bdev = bdev->md_bdev;
bio->bi_iter.bi_sector = sector;
err = -EIO;
--
2.1.0
Powered by blists - more mailing lists