]> git.baikalelectronics.ru Git - kernel.git/commit
dm cache metadata: ignore hints array being too small during resize
authorJoe Thornber <ejt@redhat.com>
Mon, 24 Sep 2018 20:19:30 +0000 (16:19 -0400)
committerMike Snitzer <snitzer@redhat.com>
Thu, 4 Oct 2018 19:20:51 +0000 (15:20 -0400)
commit3902ef32de7f23d45d5cbfaf23e298aca5e3fdd6
tree2143e12ead2aacd17d73d9ea90af991b13c5d032
parent5aacdb116b787a8e32ba1f08686c621009b33c41
dm cache metadata: ignore hints array being too small during resize

Commit 207b42e6f ("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: 207b42e6f ("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>
drivers/md/dm-cache-metadata.c