[PATCH] net/af_packet: fix qpairs argument upper bound check
Stephen Hemminger
stephen at networkplumber.org
Wed Jun 3 17:27:49 CEST 2026
On Wed, 3 Jun 2026 07:42:18 +0300
Denis Sergeev <denserg.edu at gmail.com> wrote:
> diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
> index 0ee94e71ea..ebf015dd9a 100644
> --- a/drivers/net/af_packet/rte_eth_af_packet.c
> +++ b/drivers/net/af_packet/rte_eth_af_packet.c
> @@ -1169,7 +1169,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
> pair = &kvlist->pairs[k_idx];
> if (strstr(pair->key, ETH_AF_PACKET_NUM_Q_ARG) != NULL) {
> qpairs = atoi(pair->value);
> - if (qpairs < 1) {
> + if (qpairs < 1 || qpairs > RTE_MAX_QUEUES_PER_PORT) {
> PMD_LOG(ERR,
> "%s: invalid qpairs value",
> name);
> --
I would rather see atoi() not used in DPDK, it accepts too much and does not do
enough validation. Replace with strtoul() instead.
More information about the dev
mailing list