dm integrity: fix deadlock with overlapping I/O
authorMikulas Patocka <mpatocka@redhat.com>
Fri, 5 Apr 2019 19:26:39 +0000 (15:26 -0400)
committerMike Snitzer <snitzer@redhat.com>
Fri, 5 Apr 2019 22:49:08 +0000 (18:49 -0400)
commit4ed319c6ac08e9a28fca7ac188181ac122f4de84
treeb7b1c42338a40692cde5a854406b61adb2c4d3c9
parentbcb44433bba5eaff293888ef22ffa07f1f0347d6
dm integrity: fix deadlock with overlapping I/O

dm-integrity will deadlock if overlapping I/O is issued to it, the bug
was introduced by commit 724376a04d1a ("dm integrity: implement fair
range locks").  Users rarely use overlapping I/O so this bug went
undetected until now.

Fix this bug by correcting, likely cut-n-paste, typos in
ranges_overlap() and also remove a flawed ranges_overlap() check in
remove_range_unlocked().  This condition could leave unprocessed bios
hanging on wait_list forever.

Cc: stable@vger.kernel.org # v4.19+
Fixes: 724376a04d1a ("dm integrity: implement fair range locks")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-integrity.c