Skip to content

[bnxt] Prevent out-of-bounds memory access#1735

Merged
mcb30 merged 1 commit into
ipxe:masterfrom
jw14812:bnxt_2
Jun 22, 2026
Merged

[bnxt] Prevent out-of-bounds memory access#1735
mcb30 merged 1 commit into
ipxe:masterfrom
jw14812:bnxt_2

Conversation

@jw14812

@jw14812 jw14812 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Add boundary checks to prevent out-of-bounds memory accesses in RX and HWRM paths.

@NiKiZe

NiKiZe commented Jun 15, 2026

Copy link
Copy Markdown
Member

Is it worth mentioning in the commit message why this is needed?

@mcb30

mcb30 commented Jun 15, 2026

Copy link
Copy Markdown
Member

Same comment as for #1725 - do we have a reason to expect the hardware to DMA invalid values into memory?

@jw14812

jw14812 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

We don't have a specific reason to expect the hardware to DMA invalid values, but we are in the process of hardening the driver and this enforces standard software bounds checking before accessing host memory arrays. Validating resp_len against RESP_BUFFER_SIZE ensures we never overflow the allocated DMA buffer, which protects the driver if the buffer sizes change in future HWRM specifications. Similarly, masking rx_cmp->opaque explicitly enforces our power-of-two ring boundaries in software, ensuring safe array access even if we dynamically resize rings or pack additional metadata into the opaque field in the future.

Add boundary checks to prevent out-of-bounds memory accesses in RX and
HWRM paths.

Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
@mcb30

mcb30 commented Jun 22, 2026

Copy link
Copy Markdown
Member

Thank you for the explanation. Rebasing and merging now.

@mcb30 mcb30 merged commit 781b8d6 into ipxe:master Jun 22, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants