linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Monakhov <dmonakhov@openvz.org>
To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	martin.petersen@oracle.com
Cc: Dmitry Monakhov <dmonakhov@openvz.org>
Subject: [PATCH 1/8] Guard bvec iteration logic
Date: Thu, 30 Mar 2017 17:49:29 +0400	[thread overview]
Message-ID: <1490881776-28735-2-git-send-email-dmonakhov@openvz.org> (raw)
In-Reply-To: <1490881776-28735-1-git-send-email-dmonakhov@openvz.org>

If some one try to attempt advance bvec beyond it's size we simply
dump WARN_ONCE and continue to iterate beyond bvec array boundaries.
This simply means that we endup dereferencing/corrupting random memory
region.

Code was added long time ago here 4550dd6c, luckily no one hit it
in real life :)

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 include/linux/bvec.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index 89b65b8..86b914f 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -70,8 +70,7 @@ static inline void bvec_iter_advance(const struct bio_vec *bv,
 				     struct bvec_iter *iter,
 				     unsigned bytes)
 {
-	WARN_ONCE(bytes > iter->bi_size,
-		  "Attempted to advance past end of bvec iter\n");
+	BUG_ON(bytes > iter->bi_size);
 
 	while (bytes) {
 		unsigned iter_len = bvec_iter_len(bv, *iter);
-- 
2.9.3

  reply	other threads:[~2017-03-30 13:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 13:49 [PATCH 0/8] block: T10/DIF Fixes and cleanups Dmitry Monakhov
2017-03-30 13:49 ` Dmitry Monakhov [this message]
2017-03-31  8:21   ` [PATCH 1/8] Guard bvec iteration logic Ming Lei
2017-03-30 13:49 ` [PATCH 2/8] bio-integrity: Do not allocate integrity context for bio w/o data Dmitry Monakhov
2017-03-30 13:49 ` [PATCH 3/8] bio-integrity: save original iterator for verify stage Dmitry Monakhov
2017-03-30 13:49 ` [PATCH 4/8] bio-integrity: bio_trim should truncate integrity vector accordingly Dmitry Monakhov
2017-03-30 13:49 ` [PATCH 5/8] bio-integrity: fix interface for bio_integrity_trim Dmitry Monakhov
2017-03-30 13:49 ` [PATCH 6/8] bio-integrity: add bio_integrity_setup helper Dmitry Monakhov
2017-03-31 22:15   ` kbuild test robot
2017-03-30 13:49 ` [PATCH 7/8] T10: Move opencoded contants to common header Dmitry Monakhov
2017-03-31 22:09   ` kbuild test robot
2017-03-30 13:49 ` [PATCH 8/8] tcm_fileio: Prevent information leak for short reads 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=1490881776-28735-2-git-send-email-dmonakhov@openvz.org \
    --to=dmonakhov@openvz.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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;
as well as URLs for NNTP newsgroup(s).