From: Daniil Iskhakov <dish@amicon.ru>
To: <dev@dpdk.org>, Bruce Richardson <bruce.richardson@intel.com>,
Andrey Chilikin <andrey.chilikin@intel.com>,
Beilei Xing <beilei.xing@intel.com>
Cc: Daniil Iskhakov <dish@amicon.ru>, <stable@dpdk.org>,
Daniil Agalakov <ade@amicon.ru>, <sdl.dpdk@linuxtesting.org>,
<rrv@amicon.ru>
Subject: [PATCH] net/i40e: validate DDP segment header before use
Date: Mon, 27 Apr 2026 18:44:01 +0300 [thread overview]
Message-ID: <20260427154401.1813519-1-dish@amicon.ru> (raw)
rte_pmd_i40e_get_ddp_info() retrieves the I40E segment header with
i40e_find_segment_in_package(). That helper may return NULL if the
segment cannot be found.
The returned pointer is validated only in one code path, while other
branches use it without checking. This can lead to a NULL pointer
dereference when parsing a malformed or incomplete DDP package.
Move the NULL check right before the segment usage so it applies to all
request types needed.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: edeab742edac ("net/i40e: get information about DDP profile")
Cc: stable@dpdk.org
Signed-off-by: Daniil Agalakov <ade@amicon.ru>
Signed-off-by: Daniil Iskhakov <dish@amicon.ru>
---
Cc: andrey.chilikin@intel.com
Cc: sdl.dpdk@linuxtesting.org
Cc: rrv@amicon.ru
---
drivers/net/intel/i40e/rte_pmd_i40e.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/intel/i40e/rte_pmd_i40e.c b/drivers/net/intel/i40e/rte_pmd_i40e.c
index 4fdef9464b..78b1f1f12d 100644
--- a/drivers/net/intel/i40e/rte_pmd_i40e.c
+++ b/drivers/net/intel/i40e/rte_pmd_i40e.c
@@ -1878,6 +1878,11 @@ int rte_pmd_i40e_get_ddp_info(uint8_t *pkg_buff, uint32_t pkg_size,
return I40E_SUCCESS;
}
+ if (!i40e_seg_hdr) {
+ PMD_DRV_LOG(ERR, "Failed to find i40e segment header");
+ return -EINVAL;
+ }
+
/* get i40e segment header info */
if (type == RTE_PMD_I40E_PKG_INFO_HEADER) {
struct rte_pmd_i40e_profile_info *info =
@@ -1893,11 +1898,6 @@ int rte_pmd_i40e_get_ddp_info(uint8_t *pkg_buff, uint32_t pkg_size,
return -EINVAL;
}
- if (!i40e_seg_hdr) {
- PMD_DRV_LOG(ERR, "Failed to find i40e segment header");
- return -EINVAL;
- }
-
memset(info, 0, sizeof(struct rte_pmd_i40e_profile_info));
info->owner = RTE_PMD_I40E_DDP_OWNER_UNKNOWN;
info->track_id =
--
2.43.0
next reply other threads:[~2026-04-29 9:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 15:44 Daniil Iskhakov [this message]
2026-05-05 15:43 ` [PATCH] net/i40e: validate DDP segment header before use Bruce Richardson
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=20260427154401.1813519-1-dish@amicon.ru \
--to=dish@amicon.ru \
--cc=ade@amicon.ru \
--cc=andrey.chilikin@intel.com \
--cc=beilei.xing@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=rrv@amicon.ru \
--cc=sdl.dpdk@linuxtesting.org \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox