]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.16.3/md-raid10-fix-memory-leak-when-reshaping-a-raid10.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.16.3 / md-raid10-fix-memory-leak-when-reshaping-a-raid10.patch
CommitLineData
8b77cbea
GKH
1From ce0b0a46955d1bb389684a2605dbcaa990ba0154 Mon Sep 17 00:00:00 2001
2From: NeilBrown <neilb@suse.de>
3Date: Mon, 18 Aug 2014 13:56:38 +1000
4Subject: md/raid10: fix memory leak when reshaping a RAID10.
5
6From: NeilBrown <neilb@suse.de>
7
8commit ce0b0a46955d1bb389684a2605dbcaa990ba0154 upstream.
9
10raid10 reshape clears unwanted bits from a bio->bi_flags using
11a method which, while clumsy, worked until 3.10 when BIO_OWNS_VEC
12was added.
13Since then it clears that bit but shouldn't. This results in a
14memory leak.
15
16So change to used the approved method of clearing unwanted bits.
17
18As this causes a memory leak which can consume all of memory
19the fix is suitable for -stable.
20
21Fixes: a38352e0ac02dbbd4fa464dc22d1352b5fbd06fd
22Reported-by: mdraid.pkoch@dfgh.net (Peter Koch)
23Signed-off-by: NeilBrown <neilb@suse.de>
24Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26---
27 drivers/md/raid10.c | 2 +-
28 1 file changed, 1 insertion(+), 1 deletion(-)
29
30--- a/drivers/md/raid10.c
31+++ b/drivers/md/raid10.c
32@@ -4410,7 +4410,7 @@ read_more:
33 read_bio->bi_private = r10_bio;
34 read_bio->bi_end_io = end_sync_read;
35 read_bio->bi_rw = READ;
36- read_bio->bi_flags &= ~(BIO_POOL_MASK - 1);
37+ read_bio->bi_flags &= (~0UL << BIO_RESET_BITS);
38 read_bio->bi_flags |= 1 << BIO_UPTODATE;
39 read_bio->bi_vcnt = 0;
40 read_bio->bi_iter.bi_size = 0;