drm/buddy: Fix BUG_ON from oversized rounded allocations
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest2 patches 3 repliesIn review
- v12 patches 4 repliesSuperseded
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | drm/buddy: Prevent BUG_ON by validating rounded allocationdrivers/ | +9 | 3 replies | |
| 2/2 | drm/tests/drm_buddy: Add tests for allocations exceeding max_orderdrivers/ | +35 | 0 replies |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Matthew Auld | Arunpravin Paneer Selvam |
|---|---|---|
| 1/2 | R-b | R-b |
| 2/2 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/2] drm/buddy: Fix BUG_ON from oversized rounded allocations
This series addresses a crash in drm_buddy allocator when allocation requests exceed mm->max_order after rounding operations. This can occur with non-power-of-two VRAM sizes (e.g., 10G = 8G + 2G roots) where mm->max_order represents the largest block (8G).
The issue manifests in two scenarios:
1. CONTIGUOUS allocations: roundup_pow_of_two(9G) = 16G > 10G
2. Large min_block_size: round_up(9G, 8G) = 16G > 10G
Both cases trigger BUG_ON(order > mm->max_order) deep in the allocation path, crashing the system on invalid user input.
The fix validates the rounded size early and handles it appropriately:
- For CONTIGUOUS-only allocations, use the existing try_harder fallback
- For other cases (non-contiguous, or contiguous+range), return -EINVAL
v2: (Matt A)
- Add Fixes, Cc stable, and Closes tags for context
Sanjay Yadav (2):
drm/buddy: Prevent BUG_ON by validating rounded allocation drm/tests/drm_buddy: Add tests for allocations exceeding max_order
drivers/gpu/drm/drm_buddy.c | 9 +++++++ drivers/gpu/drm/tests/drm_buddy_test.c | 35 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+)
Signature · 1 line
2.52.0