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 99D7243284; Sat, 4 Nov 2023 05:06:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 233ED4029E; Sat, 4 Nov 2023 05:06:50 +0100 (CET) Received: from out162-62-57-210.mail.qq.com (out162-62-57-210.mail.qq.com [162.62.57.210]) by mails.dpdk.org (Postfix) with ESMTP id A389D4028B; Sat, 4 Nov 2023 05:06:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1699070799; bh=0HYmBrzVHVKysi4lzjKKnLMODqYwjRhbnFPVRlMKksg=; h=From:To:Cc:Subject:Date; b=xpF7OPpH3kOfMu6UOOcmdAP1jS6kYGc6uW4Sm+CH//6C5EfI0xlEZl9JrXOeJk1Sg ekJjNmKnH532njoL+jVeX0Fv4k5y3E0OzLJJ/v7Nlf6ypCft4t7zSorK1AMM58BXqq i0coFfz2DtPRD+D8YFRTJLHI8bDlToAN5lClADts= Received: from liwg-V5320.. ([36.112.73.58]) by newxmesmtplogicsvrsza10-0.qq.com (NewEsmtp) with SMTP id 19CAD612; Sat, 04 Nov 2023 12:06:28 +0800 X-QQ-mid: xmsmtpt1699070788t27nwsqo5 Message-ID: X-QQ-XMAILINFO: OV/DSz51HsxxJ7ESzE0zDIKRGY62T0QK/UqEGfyxQnbQNvuaHppMhM6tXbG/Ps Te2DZ5FWxcZKJinfAAFcxyyzqRUtpdF0/bMPYyJhzyGtyoYezQxlNpkRXJ8ScFyqg1eUNqnYouA8 qVDYq92BxRa8j3xG//f60mLWj1XOsNGqgaD+1oJEZ37BM12pmoXv0Y4Gn1a6fRP3oCbc67P+cwLz NEad1zJkZVpYe8OHDak6hBWNsW2zDFzlbqFoKjHljKZaifjfMRuGjzX+ydO0FthTOD3bX9M7xwjZ 10EKL/TabuPE+Gg3QvUi3PVk5+jU+9pvnQt/WjavKvf42fLjm/9H4vBAhb6fyAZmOiLfDkmcXyoC XTJ6gWeW78B6H7Pq7AO3JNmf9TciJpQ9AAembQEvYizZMQJphWKpfZ/IjttG/ju/A4GReHjmhhIs ayK0FuEC8wZeR+NBLlvTYZQfQm4zGd8vhkMvSKlq9bz7qR+DbcaE//Mo8reKSrUPKxq9nRrnFldS fNfwNZhhHlQQ9xdHYzKeyydKS+agD/8ANK9yDMWHRKGHst4a5P3hFF5zO1q5axg96LMiX3inYU9A sUp4QtW68eiKGYjRiROdTfE67ZI4DrmVoQ0j61CB/p1ncc3Xh40fYqznop/vMOKitMAa9v0O1jQ8 LAvI8eh+6CbiAGdF/CGJdEllpjXJpWIdqYolM8pbt69zZ3KCtjCFLkjMD49ZXOnmjHIgSppa+U2f xxVDCS/lQpM43GFF1JEKAijZ2d8V/cOH9YqKUF/4e/yIZP8RfCHgdp8tHi+RqDqb5zDXJtxMHyJ+ b8sobrwT6HZxFhwGd7TjaIR15b50lmLA0TDFbVjDgnTfRzr2e7K6cIQbeTx+YE7WvrOr4YEAr1TI 6ti0dfkbEeE/P1LX1eDKvtyLXvqzjkL+FYJEclXxKqlMxxC+lchjgsz6Wd3YJX8QSB85v/+8ApN5 Dyj8/nDE1vXkUEAzxMSscZJ+lXjiqQZzsKmbTFPHpUkSMUwOPgzw== X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= From: Weiguo Li To: michaelba@nvidia.com Cc: matan@nvidia.com, dev@dpdk.org, stable@dpdk.org, Weiguo Li Subject: [PATCH] net/mlx5: fix null derefrence in mlx5 txq start Date: Sat, 4 Nov 2023 12:06:28 +0800 X-OQ-MSGID: <20231104040628.2050957-1-liwg06@foxmail.com> X-Mailer: git-send-email 2.34.1 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 Pointer 'txq_ctrl' was dereferenced and then compared to NULL. Change the order to keep the logic consistent. Fixes: f49f44839df3 ("net/mlx5: share Tx control code") Cc: stable@dpdk.org Signed-off-by: Weiguo Li --- drivers/net/mlx5/mlx5_trigger.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 7bdb897612..0741bf627d 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -54,11 +54,14 @@ mlx5_txq_start(struct rte_eth_dev *dev) for (i = 0; i != priv->txqs_n; ++i) { struct mlx5_txq_ctrl *txq_ctrl = mlx5_txq_get(dev, i); - struct mlx5_txq_data *txq_data = &txq_ctrl->txq; + struct mlx5_txq_data *txq_data; uint32_t flags = MLX5_MEM_RTE | MLX5_MEM_ZERO; if (!txq_ctrl) continue; + + txq_data = &txq_ctrl->txq; + if (!txq_ctrl->is_hairpin) txq_alloc_elts(txq_ctrl); MLX5_ASSERT(!txq_ctrl->obj); -- 2.34.1