From: Dmitry Monakhov <dmonakhov@openvz.org>
To: linux-kernel@vger.kernel.org
Cc: darrick.wong@oracle.com, axboe@kernel.dk, tytso@mit.edu,
jack@suse.cz, hch@infradead.org,
Dmitry Monakhov <dmonakhov@openvz.org>
Subject: [PATCH 3/5] bio: Protect submit_bio from bdevless bio-s
Date: Thu, 6 Apr 2017 16:02:47 +0400 [thread overview]
Message-ID: <1491480169-1889-4-git-send-email-dmonakhov@openvz.org> (raw)
In-Reply-To: <1491480169-1889-1-git-send-email-dmonakhov@openvz.org>
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
next prev parent reply other threads:[~2017-04-06 12:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-06 12:02 [PATCH 0/5] falloc on blockdevice: what possibly can go whong? Dmitry Monakhov
2017-04-06 12:02 ` [PATCH 1/5] bh: Prevent panic on invalid BHs Dmitry Monakhov
2017-04-06 15:42 ` Christoph Hellwig
2017-04-06 16:01 ` Dmitry Monakhov
2017-04-06 12:02 ` [PATCH 2/5] block: protect bdevname from null pointer bdev Dmitry Monakhov
2017-04-06 12:02 ` Dmitry Monakhov [this message]
2017-04-06 12:02 ` [PATCH 4/5] jbd2: use stable bdev pointer Dmitry Monakhov
2017-04-06 12:02 ` [PATCH 5/5] block: truncate page cache only when necessary on fallocate Dmitry Monakhov
2017-04-06 15:43 ` Christoph Hellwig
2017-04-06 15:51 ` Dmitry Monakhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1491480169-1889-4-git-send-email-dmonakhov@openvz.org \
--to=dmonakhov@openvz.org \
--cc=axboe@kernel.dk \
--cc=darrick.wong@oracle.com \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®