dm verity fec: limit error correction recursion
authorSami Tolvanen <samitolvanen@google.com>
Wed, 15 Mar 2017 22:12:23 +0000 (15:12 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Apr 2017 10:41:12 +0000 (12:41 +0200)
commit2ff087642643e9ac2aceb7a07c227357751c9a1b
tree951d0cf3498431fdbcfdc1b6954ce7c4e351a263
parentd9fa4351037b60068e108465afb5ddf66b8d115e
dm verity fec: limit error correction recursion

commit f1a880a93baaadb14c10a348fd199f1cdb6bcccd upstream.

If the hash tree itself is sufficiently corrupt in addition to data blocks,
it's possible for error correction to end up in a deep recursive loop,
which eventually causes a kernel panic.  This change limits the
recursion to a reasonable level during a single I/O operation.

Fixes: a739ff3f543a ("dm verity: add support for forward error correction")
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-verity-fec.c
drivers/md/dm-verity-fec.h