]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.3/dm-integrity-allow-unaligned-bv_offset.patch
Linux 4.19.46
[thirdparty/kernel/stable-queue.git] / releases / 4.14.3 / dm-integrity-allow-unaligned-bv_offset.patch
1 From 95b1369a9638cfa322ad1c0cde8efbe524059884 Mon Sep 17 00:00:00 2001
2 From: Mikulas Patocka <mpatocka@redhat.com>
3 Date: Tue, 7 Nov 2017 10:40:40 -0500
4 Subject: dm integrity: allow unaligned bv_offset
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Mikulas Patocka <mpatocka@redhat.com>
10
11 commit 95b1369a9638cfa322ad1c0cde8efbe524059884 upstream.
12
13 When slub_debug is enabled kmalloc returns unaligned memory. XFS uses
14 this unaligned memory for its buffers (if an unaligned buffer crosses a
15 page, XFS frees it and allocates a full page instead - see the function
16 xfs_buf_allocate_memory).
17
18 dm-integrity checks if bv_offset is aligned on page size and this check
19 fail with slub_debug and XFS.
20
21 Fix this bug by removing the bv_offset check, leaving only the check for
22 bv_len.
23
24 Fixes: 7eada909bfd7 ("dm: add integrity target")
25 Reported-by: Bruno Prémont <bonbons@sysophe.eu>
26 Reviewed-by: Milan Broz <gmazyland@gmail.com>
27 Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
28 Signed-off-by: Mike Snitzer <snitzer@redhat.com>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30
31 ---
32 drivers/md/dm-integrity.c | 2 +-
33 1 file changed, 1 insertion(+), 1 deletion(-)
34
35 --- a/drivers/md/dm-integrity.c
36 +++ b/drivers/md/dm-integrity.c
37 @@ -1376,7 +1376,7 @@ static int dm_integrity_map(struct dm_ta
38 struct bvec_iter iter;
39 struct bio_vec bv;
40 bio_for_each_segment(bv, bio, iter) {
41 - if (unlikely((bv.bv_offset | bv.bv_len) & ((ic->sectors_per_block << SECTOR_SHIFT) - 1))) {
42 + if (unlikely(bv.bv_len & ((ic->sectors_per_block << SECTOR_SHIFT) - 1))) {
43 DMERR("Bio vector (%u,%u) is not aligned on %u-sector boundary",
44 bv.bv_offset, bv.bv_len, ic->sectors_per_block);
45 return DM_MAPIO_KILL;