]> git.baikalelectronics.ru Git - kernel.git/commit
dm clone: Add missing casts to prevent overflows and data corruption
authorNikos Tsironis <ntsironis@arrikto.com>
Fri, 27 Mar 2020 14:01:10 +0000 (16:01 +0200)
committerMike Snitzer <snitzer@redhat.com>
Fri, 27 Mar 2020 18:42:25 +0000 (14:42 -0400)
commit98e3f61aadd69a5122353ec652166af58d8bc5a3
treea1d17e2eba1e558cbcccf03d83ed817356a45d82
parentba39a7ceb8579e898d6ea6d84bdedc881ce0031d
dm clone: Add missing casts to prevent overflows and data corruption

Add missing casts when converting from regions to sectors.

In case BITS_PER_LONG == 32, the lack of the appropriate casts can lead
to overflows and miscalculation of the device sector.

As a result, we could end up discarding and/or copying the wrong parts
of the device, thus corrupting the device's data.

Fixes: 926c5639707c ("dm: add clone target")
Cc: stable@vger.kernel.org # v5.4+
Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-clone-target.c