Bug 2376038 (CVE-2025-38162) - CVE-2025-38162 kernel: netfilter: nft_set_pipapo: prevent overflow in lookup table allocation
Summary: CVE-2025-38162 kernel: netfilter: nft_set_pipapo: prevent overflow in lookup ...
Keywords:
Status: NEW
Alias: CVE-2025-38162
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Product Security DevOps Team
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-07-03 09:01 UTC by OSIDB Bzimport
Modified: 2025-07-03 10:44 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description OSIDB Bzimport 2025-07-03 09:01:40 UTC
In the Linux kernel, the following vulnerability has been resolved:

netfilter: nft_set_pipapo: prevent overflow in lookup table allocation

When calculating the lookup table size, ensure the following
multiplication does not overflow:

- desc->field_len[] maximum value is U8_MAX multiplied by
  NFT_PIPAPO_GROUPS_PER_BYTE(f) that can be 2, worst case.
- NFT_PIPAPO_BUCKETS(f->bb) is 2^8, worst case.
- sizeof(unsigned long), from sizeof(*f->lt), lt in
  struct nft_pipapo_field.

Then, use check_mul_overflow() to multiply by bucket size and then use
check_add_overflow() to the alignment for avx2 (if needed). Finally, add
lt_size_check_overflow() helper and use it to consolidate this.

While at it, replace leftover allocation using the GFP_KERNEL to
GFP_KERNEL_ACCOUNT for consistency, in pipapo_resize().

Comment 1 Mauro Matteo Cascella 2025-07-03 10:37:13 UTC
Upstream advisory:
https://lore.kernel.org/linux-cve-announce/2025070340-CVE-2025-38162-cd74@gregkh/T


Note You need to log in before you can comment on or make changes to this bug.