From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C472A45CE2; Mon, 11 Nov 2024 17:42:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 58A2F400D6; Mon, 11 Nov 2024 17:42:42 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by mails.dpdk.org (Postfix) with ESMTP id EC7E840041; Mon, 11 Nov 2024 17:42:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1731343361; x=1762879361; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=TWrc8gjAm7wN2fk6My17gHdZbfwNnhpp6dc3D6Zjzzw=; b=mhaQVu/uQq7TyCpj0pNG0sUifpxe/ezBA4tOmpjCpCD5A5Xwld8E5tDg oga+kMc7iBQhDJ4mizdDMDkiSYhre/EyQupkx8e5jewrxG7p62XTZhDio QoDR6mS1dy9fMpZ7Crnwtp4qzLEUMLf1xZWf/U7AIIoOlGu+fD5ZaoKIa x+mRlpXNThDa3PgBwGenO/xYuzxmiYxC56taTej6YE4j4vETZtogl7Oks pSPuimVdajBflmnUU7aa4PlXJDJxBVXHBYMFZB8NdWBhSG1w4dZpXUZsp 90k38NvcP78XwQ02FalPrQlarh9CD1U4MWqZx9s3rFec8z6Y7M4WwNRPz A==; X-CSE-ConnectionGUID: nNrff8luQ5q5UkxOTr4H2A== X-CSE-MsgGUID: leYW9LAwQteRXuUTHeIsNw== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="34844756" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="34844756" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2024 08:42:39 -0800 X-CSE-ConnectionGUID: Ql3A43+YSv+ienM3GL5h7A== X-CSE-MsgGUID: zOkkF7qVQNO+Qm0b/GhHWg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,145,1728975600"; d="scan'208";a="87789428" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by orviesa008.jf.intel.com with ESMTP; 11 Nov 2024 08:42:36 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , stable@dpdk.org, Padraig Connolly , Vladimir Medvedkin , Ian Stokes , Qi Zhang , Kevin Liu Subject: [PATCH] net/iavf: add segment-length check to Tx prep Date: Mon, 11 Nov 2024 16:42:20 +0000 Message-ID: <20241111164221.3031276-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org In the Tx prep function, the metadata checks were only checking the packet length and ignoring the data length. For single-buffer packets we can quickly check that the data length is the packet length. Fixes: 19ee91c6bd9a ("net/iavf: check illegal packet sizes") Cc: stable@dpdk.org Reported-by: Padraig Connolly Signed-off-by: Bruce Richardson --- drivers/net/iavf/iavf_rxtx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 4850b9e381..6a093c6746 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -3677,7 +3677,11 @@ iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, return i; } - if (m->pkt_len < IAVF_TX_MIN_PKT_LEN) { + /* valid packets are greater than min size, and single-buffer pkts + * must have data_len == pkt_len + */ + if (m->pkt_len < IAVF_TX_MIN_PKT_LEN || + (m->nb_segs == 1 && m->data_len != m->pkt_len)) { rte_errno = EINVAL; return i; } -- 2.43.0