[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1491480169-1889-4-git-send-email-dmonakhov@openvz.org>
Date: Thu, 6 Apr 2017 16:02:47 +0400
From: Dmitry Monakhov <dmonakhov@...nvz.org>
To: linux-kernel@...r.kernel.org
Cc: darrick.wong@...cle.com, axboe@...nel.dk, tytso@....edu,
jack@...e.cz, hch@...radead.org,
Dmitry Monakhov <dmonakhov@...nvz.org>
Subject: [PATCH 3/5] bio: Protect submit_bio from bdevless bio-s
Idially this type of check should be handled at generic_make_request_checks
, but it is too late for bdevless bios, bad pointer was already
dereferenced at that point.
Signed-off-by: Dmitry Monakhov <dmonakhov@...nvz.org>
---
block/blk-core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/block/blk-core.c b/block/blk-core.c
index 275c1e4..e583ded 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2065,6 +2065,11 @@ EXPORT_SYMBOL(generic_make_request);
*/
blk_qc_t submit_bio(struct bio *bio)
{
+ if (WARN_ON_ONCE(!bio->bi_bdev)) {
+ bio_io_error(bio);
+ return BLK_QC_T_NONE;
+ }
+
/*
* If it's a regular read/write or a barrier with data attached,
* go through the normal accounting stuff before submission.
--
2.9.3
Powered by blists - more mailing lists