From: Denis Sergeev <denserg.edu@gmail.com>
To: dev@dpdk.org
Cc: shepard.siegel@atomicrules.com, ed.czeck@atomicrules.com,
john.miller@atomicrules.com, stable@dpdk.org,
sdl.dpdk@linuxtesting.org, Denis Sergeev <denserg.edu@gmail.com>
Subject: [PATCH v2] net/ark: fix null dereference on allocation failure
Date: Wed, 3 Jun 2026 08:32:02 +0300 [thread overview]
Message-ID: <20260603053214.119296-1-denserg.edu@gmail.com> (raw)
In-Reply-To: <20260603052207.118688-1-denserg.edu@gmail.com>
rte_zmalloc_socket() can return NULL when memory is exhausted.
The result is passed directly to memcpy() without a NULL check,
leading to undefined behavior. Add a NULL check consistent with
the existing check for mac_addrs allocation in the same function.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: bf73ee28f47b ("net/ark: support single function with multiple port")
Cc: stable@dpdk.org
Signed-off-by: Denis Sergeev <denserg.edu@gmail.com>
---
v2:
* Fix Fixes: tag to use 12-char sha1 (checkpatch BAD_FIXES_TAG)
drivers/net/ark/ark_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 8b25ed948f..546a44704f 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -445,6 +445,12 @@ ark_dev_init(struct rte_eth_dev *dev)
sizeof(struct ark_adapter),
RTE_CACHE_LINE_SIZE,
rte_socket_id());
+ if (eth_dev->data->dev_private == NULL) {
+ ARK_PMD_LOG(ERR,
+ "Memory allocation for dev_private failed!"
+ " Exiting.\n");
+ goto error;
+ }
memcpy(eth_dev->data->dev_private, ark,
sizeof(struct ark_adapter));
--
2.50.1
next prev parent reply other threads:[~2026-06-03 5:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 5:21 [PATCH] net/ark: fix null dereference on allocation failure Denis Sergeev
2026-06-03 5:32 ` Denis Sergeev [this message]
2026-06-03 16:32 ` [PATCH v3] " Denis Sergeev
2026-06-03 15:31 ` [PATCH] " Stephen Hemminger
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=20260603053214.119296-1-denserg.edu@gmail.com \
--to=denserg.edu@gmail.com \
--cc=dev@dpdk.org \
--cc=ed.czeck@atomicrules.com \
--cc=john.miller@atomicrules.com \
--cc=sdl.dpdk@linuxtesting.org \
--cc=shepard.siegel@atomicrules.com \
--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