]>
Commit | Line | Data |
---|---|---|
8b77cbea GKH |
1 | From ce0b0a46955d1bb389684a2605dbcaa990ba0154 Mon Sep 17 00:00:00 2001 |
2 | From: NeilBrown <neilb@suse.de> | |
3 | Date: Mon, 18 Aug 2014 13:56:38 +1000 | |
4 | Subject: md/raid10: fix memory leak when reshaping a RAID10. | |
5 | ||
6 | From: NeilBrown <neilb@suse.de> | |
7 | ||
8 | commit ce0b0a46955d1bb389684a2605dbcaa990ba0154 upstream. | |
9 | ||
10 | raid10 reshape clears unwanted bits from a bio->bi_flags using | |
11 | a method which, while clumsy, worked until 3.10 when BIO_OWNS_VEC | |
12 | was added. | |
13 | Since then it clears that bit but shouldn't. This results in a | |
14 | memory leak. | |
15 | ||
16 | So change to used the approved method of clearing unwanted bits. | |
17 | ||
18 | As this causes a memory leak which can consume all of memory | |
19 | the fix is suitable for -stable. | |
20 | ||
21 | Fixes: a38352e0ac02dbbd4fa464dc22d1352b5fbd06fd | |
22 | Reported-by: mdraid.pkoch@dfgh.net (Peter Koch) | |
23 | Signed-off-by: NeilBrown <neilb@suse.de> | |
24 | Signed-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; |