]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
dm-integrity: recheck the integrity tag after a failure
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 19 Feb 2024 20:27:39 +0000 (21:27 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Mar 2024 12:34:59 +0000 (13:34 +0100)
commitd6824a28b244e8a750952848e4bd2167e1e9a17e
treee6065b8c7293be16d7e6c67f5ca3ee2a6fc92355
parent78d41d9ba0b1fe60fc72e8e0835a2252692bfe9f
dm-integrity: recheck the integrity tag after a failure

commit c88f5e553fe38b2ffc4c33d08654e5281b297677 upstream.

If a userspace process reads (with O_DIRECT) multiple blocks into the same
buffer, dm-integrity reports an error [1]. The error is reported in a log
and it may cause RAID leg being kicked out of the array.

This commit fixes dm-integrity, so that if integrity verification fails,
the data is read again into a kernel buffer (where userspace can't modify
it) and the integrity tag is rechecked. If the recheck succeeds, the
content of the kernel buffer is copied into the user buffer; if the
recheck fails, an integrity error is reported.

[1] https://people.redhat.com/~mpatocka/testcases/blk-auth-modify/read2.c

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-integrity.c