* [PATCH 5.10/5.15] dm-verity: fix buffer overflow in FEC calculation
@ 2026-11-05 9:19 Mikhail Dmitrichenko
2026-11-05 19:33 ` Eric Biggers
0 siblings, 1 reply; 2+ messages in thread
From: Mikhail Dmitrichenko @ 2026-11-05 9:19 UTC (permalink / raw)
To: stable, Greg Kroah-Hartman
Cc: Mikhail Dmitrichenko, Mikulas Patocka, Alasdair Kergon,
Mike Snitzer, Benjamin Marzinski, Sami Tolvanen, dm-devel,
linux-kernel, lvc-project
From: Mikulas Patocka <mpatocka@redhat.com>
commit 31d6e6c0ba8d5a7bd59660035a089307100c5e8e upstream.
There's a buffer overflow in dm-verity-fec:
if (neras && *neras <= v->fec->roots)
fio->erasures[(*neras)++] = i;
This allows *neras to reach roots + 1 (the post-increment pushes it past
roots). This value is then passed as no_eras to decode_rs8(). Inside the
RS decoder (lib/reed_solomon/decode_rs.c:113-121), the erasure locator
polynomial loop writes lambda[j] where j can reach nroots + 1 — one
element past the end of lambda[] (which is sized nroots + 1, valid
indices 0..nroots). The out-of-bounds write lands on syn[0], corrupting
the syndrome buffer.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Assisted-by: Claude:claude-opus-4-6
Cc: stable@vger.kernel.org
Fixes: a739ff3f543a ("dm verity: add support for forward error correction")
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
[mdmitrichenko: Omit the erasures array size cleanup. The older
implementation already allocates 253 entries, more than the
maximum of 24 roots.]
Signed-off-by: Mikhail Dmitrichenko <mdmitrichenko@astralinux.ru>
---
Backport fix for CVE-2026-72098.
drivers/md/dm-verity-fec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-verity-fec.c b/drivers/md/dm-verity-fec.c
index 3c027b15476a3..9eb07b820848b 100644
--- a/drivers/md/dm-verity-fec.c
+++ b/drivers/md/dm-verity-fec.c
@@ -256,7 +256,7 @@ static int fec_read_bufs(struct dm_verity *v, struct dm_verity_io *io,
(unsigned long long)block, PTR_ERR(bbuf));
/* assume the block is corrupted */
- if (neras && *neras <= v->fec->roots)
+ if (neras && *neras < v->fec->roots)
fio->erasures[(*neras)++] = i;
continue;
@@ -274,7 +274,7 @@ static int fec_read_bufs(struct dm_verity *v, struct dm_verity_io *io,
* skip if we have already found the theoretical
* maximum number (i.e. fec->roots) of erasures
*/
- if (neras && *neras <= v->fec->roots &&
+ if (neras && *neras < v->fec->roots &&
fec_is_erasure(v, io, want_digest, bbuf))
fio->erasures[(*neras)++] = i;
}
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 5.10/5.15] dm-verity: fix buffer overflow in FEC calculation
2026-11-05 9:19 [PATCH 5.10/5.15] dm-verity: fix buffer overflow in FEC calculation Mikhail Dmitrichenko
@ 2026-11-05 19:33 ` Eric Biggers
0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2026-11-05 19:33 UTC (permalink / raw)
To: Mikhail Dmitrichenko
Cc: stable, Greg Kroah-Hartman, Mikulas Patocka, Alasdair Kergon,
Mike Snitzer, Benjamin Marzinski, Sami Tolvanen, dm-devel,
linux-kernel, lvc-project
On Thu, Nov 05, 2026 at 12:19:01PM +0300, Mikhail Dmitrichenko wrote:
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> [mdmitrichenko: Omit the erasures array size cleanup. The older
> implementation already allocates 253 entries, more than the
> maximum of 24 roots.]
> Signed-off-by: Mikhail Dmitrichenko <mdmitrichenko@astralinux.ru>
> ---
> Backport fix for CVE-2026-72098.
Looks fine. I would have mentioned that 6.1 needs this too, but the
same backport was already released there without dm-devel being Cc'ed
anyway.
- Eric
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-05 19:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 9:19 [PATCH 5.10/5.15] dm-verity: fix buffer overflow in FEC calculation Mikhail Dmitrichenko
2026-11-05 19:33 ` Eric Biggers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®