Skip to content

Commit 4561ffc

Browse files
jthornbersnitm
authored andcommitted
dm cache metadata: ignore hints array being too small during resize
Commit fd2fa95 ("dm cache metadata: save in-core policy_hint_size to on-disk superblock") enabled previously written policy hints to be used after a cache is reactivated. But in doing so the cache metadata's hint array was left exposed to out of bounds access because on resize the metadata's on-disk hint array wasn't ever extended. Fix this by ignoring that there are no on-disk hints associated with the newly added cache blocks. An expanded on-disk hint array is later rewritten upon the next clean shutdown of the cache. Fixes: fd2fa95 ("dm cache metadata: save in-core policy_hint_size to on-disk superblock") Cc: stable@vger.kernel.org Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
1 parent 0328ba9 commit 4561ffc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/md/dm-cache-metadata.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,8 +1455,8 @@ static int __load_mappings(struct dm_cache_metadata *cmd,
14551455
if (hints_valid) {
14561456
r = dm_array_cursor_next(&cmd->hint_cursor);
14571457
if (r) {
1458-
DMERR("dm_array_cursor_next for hint failed");
1459-
goto out;
1458+
dm_array_cursor_end(&cmd->hint_cursor);
1459+
hints_valid = false;
14601460
}
14611461
}
14621462

0 commit comments

Comments
 (0)