]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/buffer.c
ubifs: Reject unsupported ioctl flags explicitly
[mirror_ubuntu-bionic-kernel.git] / fs / buffer.c
index 0c8df87c9eaaac65e3cce3d472ebbe8a3c08bd5c..e744e18ec0685ce1f95474418d72f94ad2c8098d 100644 (file)
@@ -3045,6 +3045,13 @@ void guard_bio_eod(int op, 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;