dm integrity: fix deadlock with overlapping I/O
authorMikulas Patocka <mpatocka@redhat.com>
Fri, 5 Apr 2019 19:26:39 +0000 (15:26 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Apr 2019 06:38:54 +0000 (08:38 +0200)
commitaa9ee4b1ed46b504097da723c9b700a328956d28
treeed3b13d8c5537db8e6940351e0f990f48992d3c5
parent469b40a429c54b21eb499287daaea08559793854
dm integrity: fix deadlock with overlapping I/O

commit 4ed319c6ac08e9a28fca7ac188181ac122f4de84 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-integrity.c