[PATCH 0/1] btrfs: strengthen integer overflow protection in batch allocation

kmpfqgdwxucqz9@gmail.com posted 1 patch 2 months, 1 week ago
fs/btrfs/tree-log.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
[PATCH 0/1] btrfs: strengthen integer overflow protection in batch allocation
Posted by kmpfqgdwxucqz9@gmail.com 2 months, 1 week ago
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