Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1617912 > unrolled thread

[PATCH 3/5] bio: Protect submit_bio from bdevless bio-s

Started byDmitry Monakhov <dmonakhov@openvz.org>
First post2017-04-06 14:10 +0200
Last post2017-04-06 14:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/5] bio: Protect submit_bio from bdevless bio-s Dmitry Monakhov <dmonakhov@openvz.org> - 2017-04-06 14:10 +0200

#1617912 — [PATCH 3/5] bio: Protect submit_bio from bdevless bio-s

FromDmitry Monakhov <dmonakhov@openvz.org>
Date2017-04-06 14:10 +0200
Subject[PATCH 3/5] bio: Protect submit_bio from bdevless bio-s
Message-ID<tteoG-8jD-21@gated-at.bofh.it>
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@openvz.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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web