]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.18.14/dm-cache-metadata-ignore-hints-array-being-too-small-during-resize.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.18.14 / dm-cache-metadata-ignore-hints-array-being-too-small-during-resize.patch
1 From 4561ffca88c546f96367f94b8f1e4715a9c62314 Mon Sep 17 00:00:00 2001
2 From: Joe Thornber <ejt@redhat.com>
3 Date: Mon, 24 Sep 2018 16:19:30 -0400
4 Subject: dm cache metadata: ignore hints array being too small during resize
5
6 From: Joe Thornber <ejt@redhat.com>
7
8 commit 4561ffca88c546f96367f94b8f1e4715a9c62314 upstream.
9
10 Commit fd2fa9541 ("dm cache metadata: save in-core policy_hint_size to
11 on-disk superblock") enabled previously written policy hints to be
12 used after a cache is reactivated. But in doing so the cache
13 metadata's hint array was left exposed to out of bounds access because
14 on resize the metadata's on-disk hint array wasn't ever extended.
15
16 Fix this by ignoring that there are no on-disk hints associated with the
17 newly added cache blocks. An expanded on-disk hint array is later
18 rewritten upon the next clean shutdown of the cache.
19
20 Fixes: fd2fa9541 ("dm cache metadata: save in-core policy_hint_size to on-disk superblock")
21 Cc: stable@vger.kernel.org
22 Signed-off-by: Joe Thornber <ejt@redhat.com>
23 Signed-off-by: Mike Snitzer <snitzer@redhat.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26 ---
27 drivers/md/dm-cache-metadata.c | 4 ++--
28 1 file changed, 2 insertions(+), 2 deletions(-)
29
30 --- a/drivers/md/dm-cache-metadata.c
31 +++ b/drivers/md/dm-cache-metadata.c
32 @@ -1455,8 +1455,8 @@ static int __load_mappings(struct dm_cac
33 if (hints_valid) {
34 r = dm_array_cursor_next(&cmd->hint_cursor);
35 if (r) {
36 - DMERR("dm_array_cursor_next for hint failed");
37 - goto out;
38 + dm_array_cursor_end(&cmd->hint_cursor);
39 + hints_valid = false;
40 }
41 }
42