]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.177/it-s-wrong-to-add-len-to-sector_nr-in-raid10-reshape-twice.patch
Linux 4.4.177
[thirdparty/kernel/stable-queue.git] / releases / 4.4.177 / it-s-wrong-to-add-len-to-sector_nr-in-raid10-reshape-twice.patch
CommitLineData
aac86e04
GKH
1From b761dcf1217760a42f7897c31dcb649f59b2333e Mon Sep 17 00:00:00 2001
2From: Xiao Ni <xni@redhat.com>
3Date: Fri, 8 Mar 2019 23:52:05 +0800
4Subject: It's wrong to add len to sector_nr in raid10 reshape twice
5
6From: Xiao Ni <xni@redhat.com>
7
8commit b761dcf1217760a42f7897c31dcb649f59b2333e upstream.
9
10In reshape_request it already adds len to sector_nr already. It's wrong to add len to
11sector_nr again after adding pages to bio. If there is bad block it can't copy one chunk
12at a time, it needs to goto read_more. Now the sector_nr is wrong. It can cause data
13corruption.
14
15Cc: stable@vger.kernel.org # v3.16+
16Signed-off-by: Xiao Ni <xni@redhat.com>
17Signed-off-by: Song Liu <songliubraving@fb.com>
18Signed-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;