From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [DPDK/ethdev Bug 2091] net/ice: get_module_eeprom() silently drops trailing bytes when read length is not a multiple of 8
Date: Tue, 03 Nov 2026 15:17:52 +0000 [thread overview]
Message-ID: <bug-2091-3@https.bugs.dpdk.org/> (raw)
https://bugs.dpdk.org/show_bug.cgi?id=2091
Bug ID: 2091
Summary: net/ice: get_module_eeprom() silently drops trailing
bytes when read length is not a multiple of 8
Product: DPDK
Version: 25.11
Hardware: x86
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: Normal
Component: ethdev
Assignee: dev@dpdk.org
Reporter: marcel@telka.sk
Target Milestone: ---
ice_get_module_eeprom() reads the transceiver EEPROM in fixed 8-byte blocks via
ice_aq_sff_eeprom(). The hardware read happens unconditionally for every block,
including a trailing partial one, but the copy into the caller's buffer is
gated by an all-or-nothing check:
https://github.com/DPDK/dpdk/blob/a13c1053360ee26bbacca9f883d3f3cb83a0f366/drivers/net/intel/ice/ice_ethdev.c#L6765-L6767
/* Make sure we have enough room for the new block */
if ((i + SFF_READ_BLOCK_SIZE) <= info->length)
memcpy(data + i, value, SFF_READ_BLOCK_SIZE);
When info->length is not an exact multiple of SFF_READ_BLOCK_SIZE (8), the
final loop iteration reads the correct 8 bytes from the module into value[],
but the guard evaluates false (e.g. i=88, length=90: 88+8=96 > 90), so the
memcpy is skipped entirely. Since the destination buffer is memset to 0 at
function entry, the trailing length % 8 bytes are silently returned as zero
instead of the real EEPROM content, with no error indication to the caller.
This is a different (and still-open) case of the same bug class fixed in
31f15787 ("net/ice: fix module EEPROM read", Oct 2022), which only addressed
the complementary edge case where length is an exact multiple of 8 (changing
the guard from < to <=). That fix did not address non-multiple lengths at all.
The equivalent Linux kernel driver (ice_get_module_eeprom() in ice_ethtool.c)
had the same underlying bug and fixed it completely as CVE-2023-53142, by
replacing the all-or-nothing guard with a clamped partial copy:
https://github.com/torvalds/linux/commit/84cba1840e68430325ac133a11be06bfb2f7acd8
/* Make sure we have enough room for the new block */
copy_len = min_t(u32, SFF_READ_BLOCK_SIZE, ee->len - i);
memcpy(data + i, value, copy_len);
The DPDK ice PMD never picked up this more complete fix.
Steps to Reproduce:
1. On a port using the ice PMD with an SFF-8472 transceiver attached, call
rte_eth_dev_get_module_eeprom() with offset=3, length=90 (deliberately not a
multiple of 8, e.g. the common "read compliance codes + vendor fields + DDM
type byte in one request, skip the padding gap before A2h" pattern).
2. Compare the returned buffer's last 2 bytes against an independent read of
the same EEPROM region (e.g. via the kernel ice driver + ethtool -m on the same
port, after temporarily unbinding from vfio-pci).
Expected: all 90 requested bytes match the module's actual EEPROM content.
Actual: the last 2 bytes (length % 8) come back as 0x00, regardless of their
real value. Confirmed concretely: byte 92 (SFF-8472 "Diagnostic Monitoring
Type," containing the DDM-implemented bit) returned 0x00 via this 90-byte read,
but 0x68 (DDM bit correctly set) via an independent ethtool -m read of the same
module. Re-running the same rte_eth_dev_get_module_eeprom() call with length=96
(a clean multiple of 8 that fully covers byte 92 within a complete block)
correctly returns 0x68, directly confirming the root cause.
Suggested fix: replace the all-or-nothing guard with a clamped partial copy,
matching the Linux kernel's fix:
uint32_t copy_len = RTE_MIN((uint32_t)SFF_READ_BLOCK_SIZE, info->length -
i);
memcpy(data + i, value, copy_len);
--
You are receiving this mail because:
You are the assignee for the bug.
reply other threads:[~2026-11-03 15:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-2091-3@https.bugs.dpdk.org/ \
--to=bugzilla@dpdk.org \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.