[ Sasha's backport helper bot ] Hi, Found matching upstream commit: 6df90c02bae468a3a6110bafbc659884d0c4966c Status in newer kernel trees: 6.12.y | Present (different SHA1: 16c9c0afd88d) 6.6.y | Not found Note: The patch differs from the upstream commit: --- 1: 6df90c02bae4 ! 1: c91919dd6e7e dm-verity FEC: Fix RS FEC repair for roots unaligned to block size (take 2) @@ Commit message Fixes: 8ca7cab82bda ("dm verity fec: fix misaligned RS roots IO") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx> + (cherry picked from commit 6df90c02bae468a3a6110bafbc659884d0c4966c) + Signed-off-by: Milan Broz <gmazyland@xxxxxxxxx> ## drivers/md/dm-verity-fec.c ## @@ drivers/md/dm-verity-fec.c: static int fec_decode_rs8(struct dm_verity *v, struct dm_verity_fec_io *fio, * to the data block. Caller is responsible for releasing buf. */ static u8 *fec_read_parity(struct dm_verity *v, u64 rsb, int index, -- unsigned int *offset, struct dm_buffer **buf, -- unsigned short ioprio) +- unsigned int *offset, struct dm_buffer **buf) + unsigned int *offset, unsigned int par_buf_offset, -+ struct dm_buffer **buf, unsigned short ioprio) ++ struct dm_buffer **buf) { u64 position, block, rem; u8 *res; @@ drivers/md/dm-verity-fec.c: static int fec_decode_rs8(struct dm_verity *v, struc - *offset = (unsigned int)rem; + *offset = par_buf_offset ? 0 : (unsigned int)rem; - res = dm_bufio_read_with_ioprio(v->fec->bufio, block, buf, ioprio); + res = dm_bufio_read(v->fec->bufio, block, buf); if (IS_ERR(res)) { -@@ drivers/md/dm-verity-fec.c: static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_io *io, +@@ drivers/md/dm-verity-fec.c: static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio, { int r, corrected = 0, res; struct dm_buffer *buf; @@ drivers/md/dm-verity-fec.c: static int fec_decode_bufs(struct dm_verity *v, stru - u8 *par, *block; + unsigned int n, i, offset, par_buf_offset = 0; + u8 *par, *block, par_buf[DM_VERITY_FEC_RSM - DM_VERITY_FEC_MIN_RSN]; - struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); -- par = fec_read_parity(v, rsb, block_offset, &offset, &buf, bio_prio(bio)); +- par = fec_read_parity(v, rsb, block_offset, &offset, &buf); + par = fec_read_parity(v, rsb, block_offset, &offset, -+ par_buf_offset, &buf, bio_prio(bio)); ++ par_buf_offset, &buf); if (IS_ERR(par)) return PTR_ERR(par); -@@ drivers/md/dm-verity-fec.c: static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_io *io, +@@ drivers/md/dm-verity-fec.c: static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio, */ fec_for_each_buffer_rs_block(fio, n, i) { block = fec_buffer_rs_block(v, fio, n, i); @@ drivers/md/dm-verity-fec.c: static int fec_decode_bufs(struct dm_verity *v, stru if (res < 0) { r = res; goto error; -@@ drivers/md/dm-verity-fec.c: static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_io *io, +@@ drivers/md/dm-verity-fec.c: static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio, if (block_offset >= 1 << v->data_dev_block_bits) goto done; @@ drivers/md/dm-verity-fec.c: static int fec_decode_bufs(struct dm_verity *v, stru if (offset >= v->fec->io_size) { dm_bufio_release(buf); -- par = fec_read_parity(v, rsb, block_offset, &offset, &buf, bio_prio(bio)); +- par = fec_read_parity(v, rsb, block_offset, &offset, &buf); + par = fec_read_parity(v, rsb, block_offset, &offset, -+ par_buf_offset, &buf, bio_prio(bio)); ++ par_buf_offset, &buf); if (IS_ERR(par)) return PTR_ERR(par); } --- Results of testing on various branches: | Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.6.y | Success | Success |