linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] btrfs: strengthen integer overflow protection in batch allocation
@ 2025-07-30  4:43 kmpfqgdwxucqz9
  2025-07-30  4:43 ` [PATCH 1/1] btrfs: add integer overflow protection to flush_dir_items_batch allocation kmpfqgdwxucqz9
  0 siblings, 1 reply; 7+ messages in thread
From: kmpfqgdwxucqz9 @ 2025-07-30  4:43 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs, linux-kernel, KernelKraze

From: KernelKraze <admin@mail.free-proletariat.dpdns.org>

Hi,

This patch improves robustness in the btrfs filesystem by adding integer
overflow protection during batch allocation in flush_dir_items_batch().

The improvement was identified during a systematic code review of kernel
subsystems. Without proper bounds checking, theoretical integer overflow
could occur with extremely large directory item counts.

The fix implements proper overflow checking using the kernel's overflow
detection helpers and adds a reasonable upper limit consistent with other
btrfs batch operations.

This has been compile-tested and the fix aligns with existing patterns
in the btrfs codebase (log_delayed_insertion_items uses the same 195 limit).
The patch passes checkpatch.pl with no errors or warnings.

I've CC'd the btrfs maintainers for review.

Thanks,
KernelKraze

KernelKraze (1):
  btrfs: add integer overflow protection to flush_dir_items_batch allocation

 fs/btrfs/tree-log.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

-- 
2.48.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-07-30 10:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-30  4:43 [PATCH 0/1] btrfs: strengthen integer overflow protection in batch allocation kmpfqgdwxucqz9
2025-07-30  4:43 ` [PATCH 1/1] btrfs: add integer overflow protection to flush_dir_items_batch allocation kmpfqgdwxucqz9
2025-07-30  6:35   ` Johannes Thumshirn
2025-07-30  6:58     ` kmpfqgdwxucqz9
2025-07-30  7:06   ` Qu Wenruo
2025-07-30  7:20     ` [PATCH 1/1] btrfs: add integer overflow protection to flush_dir_items_batch allocation - WITHDRAWN kmpfqgdwxucqz9
2025-07-30 10:20   ` [PATCH 1/1] btrfs: add integer overflow protection to flush_dir_items_batch allocation Filipe Manana

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).