mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 20:54:03 +02:00
xfs: fix wild memcpy access when formatting ondisk rtrefcount btree roots
LOLLM noticed that the inode btree root formatting methods copy too many
bytes -- there's only one set of keys in node blocks, not two. This
causes memory corruption of whatever's beyond the buffers.
Cc: stable@vger.kernel.org # v6.14
Fixes: f0415af60f ("xfs: wire up a new metafile type for the realtime refcount")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
parent
476582d754
commit
fe2f9135df
|
|
@ -617,7 +617,7 @@ xfs_rtrefcountbt_from_disk(
|
|||
fpp = xfs_rtrefcount_droot_ptr_addr(dblock, 1, maxrecs);
|
||||
tpp = xfs_rtrefcount_broot_ptr_addr(mp, rblock, 1, rblocklen);
|
||||
numrecs = be16_to_cpu(dblock->bb_numrecs);
|
||||
memcpy(tkp, fkp, 2 * sizeof(*fkp) * numrecs);
|
||||
memcpy(tkp, fkp, sizeof(*fkp) * numrecs);
|
||||
memcpy(tpp, fpp, sizeof(*fpp) * numrecs);
|
||||
} else {
|
||||
frp = xfs_rtrefcount_droot_rec_addr(dblock, 1);
|
||||
|
|
@ -703,7 +703,7 @@ xfs_rtrefcountbt_to_disk(
|
|||
fpp = xfs_rtrefcount_broot_ptr_addr(mp, rblock, 1, rblocklen);
|
||||
tpp = xfs_rtrefcount_droot_ptr_addr(dblock, 1, maxrecs);
|
||||
numrecs = be16_to_cpu(rblock->bb_numrecs);
|
||||
memcpy(tkp, fkp, 2 * sizeof(*fkp) * numrecs);
|
||||
memcpy(tkp, fkp, sizeof(*fkp) * numrecs);
|
||||
memcpy(tpp, fpp, sizeof(*fpp) * numrecs);
|
||||
} else {
|
||||
frp = xfs_rtrefcount_rec_addr(rblock, 1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user