diff options
author | Sami Tolvanen <samitolvanen@google.com> | 2017-03-15 23:12:23 +0100 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2017-03-16 14:37:31 +0100 |
commit | f1a880a93baaadb14c10a348fd199f1cdb6bcccd (patch) | |
tree | c2ce582e5337e48033a5c56ded2435f9759e5f2a /drivers/md/dm-verity-fec.h | |
parent | Linux 4.11-rc2 (diff) | |
download | linux-f1a880a93baaadb14c10a348fd199f1cdb6bcccd.tar.xz linux-f1a880a93baaadb14c10a348fd199f1cdb6bcccd.zip |
dm verity fec: limit error correction recursion
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>
Cc: stable@vger.kernel.org # v4.5+
Diffstat (limited to 'drivers/md/dm-verity-fec.h')
-rw-r--r-- | drivers/md/dm-verity-fec.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/md/dm-verity-fec.h b/drivers/md/dm-verity-fec.h index 7fa0298b995e..bb31ce87a933 100644 --- a/drivers/md/dm-verity-fec.h +++ b/drivers/md/dm-verity-fec.h @@ -27,6 +27,9 @@ #define DM_VERITY_FEC_BUF_MAX \ (1 << (PAGE_SHIFT - DM_VERITY_FEC_BUF_RS_BITS)) +/* maximum recursion level for verity_fec_decode */ +#define DM_VERITY_FEC_MAX_RECURSION 4 + #define DM_VERITY_OPT_FEC_DEV "use_fec_from_device" #define DM_VERITY_OPT_FEC_BLOCKS "fec_blocks" #define DM_VERITY_OPT_FEC_START "fec_start" @@ -58,6 +61,7 @@ struct dm_verity_fec_io { unsigned nbufs; /* number of buffers allocated */ u8 *output; /* buffer for corrected output */ size_t output_pos; + unsigned level; /* recursion level */ }; #ifdef CONFIG_DM_VERITY_FEC |