]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/it-s-wrong-to-add-len-to-sector_nr-in-raid10-reshape-twice.patch
Linux 3.18.137
[thirdparty/kernel/stable-queue.git] / queue-4.4 / it-s-wrong-to-add-len-to-sector_nr-in-raid10-reshape-twice.patch
1 From b761dcf1217760a42f7897c31dcb649f59b2333e Mon Sep 17 00:00:00 2001
2 From: Xiao Ni <xni@redhat.com>
3 Date: Fri, 8 Mar 2019 23:52:05 +0800
4 Subject: It's wrong to add len to sector_nr in raid10 reshape twice
5
6 From: Xiao Ni <xni@redhat.com>
7
8 commit b761dcf1217760a42f7897c31dcb649f59b2333e upstream.
9
10 In reshape_request it already adds len to sector_nr already. It's wrong to add len to
11 sector_nr again after adding pages to bio. If there is bad block it can't copy one chunk
12 at a time, it needs to goto read_more. Now the sector_nr is wrong. It can cause data
13 corruption.
14
15 Cc: stable@vger.kernel.org # v3.16+
16 Signed-off-by: Xiao Ni <xni@redhat.com>
17 Signed-off-by: Song Liu <songliubraving@fb.com>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20 ---
21 drivers/md/raid10.c | 1 -
22 1 file changed, 1 deletion(-)
23
24 --- a/drivers/md/raid10.c
25 +++ b/drivers/md/raid10.c
26 @@ -4442,7 +4442,6 @@ bio_full:
27 atomic_inc(&r10_bio->remaining);
28 read_bio->bi_next = NULL;
29 generic_make_request(read_bio);
30 - sector_nr += nr_sectors;
31 sectors_done += nr_sectors;
32 if (sector_nr <= last)
33 goto read_more;