aboutsummaryrefslogtreecommitdiff
path: root/fs/buffer.c
diff options
context:
space:
mode:
authorronaxdevil <pratabidya.007@gmail.com>2020-06-06 12:16:58 +0530
committerlucasponez <lucasponez@outlook.com>2020-12-06 05:32:19 -0800
commitc9d101bffe7b6a10fddc18bc7a2d0dc0962ed71f (patch)
treecc92c8d9bbff0f97a4036908f210b2adb2adaf1a /fs/buffer.c
parent13ba6318ccffd7e3167f514ac34358ab74ff6b6c (diff)
Merge tag 'v3.18.140' of https://source.codeaurora.org/quic/la/kernel/msm-3.18 into android-10-release-qpk30.54r11.0
This is the 3.18.140 stable release gpg: Signature made Thu 16 May 2019 12:47:33 PM IST gpg: using RSA key 647F28654894E3BD457199BE38DBBDC86092693E Signed-off-by: ronaxdevil <pratabidya.007@gmail.com>
Diffstat (limited to 'fs/buffer.c')
-rw-r--r--fs/buffer.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index d2b5be9f4348..99c994ee6aad 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3035,6 +3035,13 @@ void guard_bio_eod(int rw, struct bio *bio)
/* Uhhuh. We've got a bio that straddles the device size! */
truncated_bytes = bio->bi_iter.bi_size - (maxsector << 9);
+ /*
+ * The bio contains more than one segment which spans EOD, just return
+ * and let IO layer turn it into an EIO
+ */
+ if (truncated_bytes > bvec->bv_len)
+ return;
+
/* Truncate the bio.. */
bio->bi_iter.bi_size -= truncated_bytes;
bvec->bv_len -= truncated_bytes;