From patchwork Tue Jan 26 03:49:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiawei Wang X-Patchwork-Id: 87272 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C4E69A052A; Tue, 26 Jan 2021 04:49:47 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD0731411FD; Tue, 26 Jan 2021 04:49:47 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id 956181411FC for ; Tue, 26 Jan 2021 04:49:46 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from jiaweiw@nvidia.com) with SMTP; 26 Jan 2021 05:49:42 +0200 Received: from nvidia.com (gen-l-vrt-281.mtl.labs.mlnx [10.237.44.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 10Q3ngEi012814; Tue, 26 Jan 2021 05:49:42 +0200 From: Jiawei Wang To: viacheslavo@nvidia.com, orika@nvidia.com, thomas@monjalon.net, ferruh.yigit@intel.com Cc: dev@dpdk.org Date: Tue, 26 Jan 2021 05:49:42 +0200 Message-Id: <1611632982-415500-1-git-send-email-jiaweiw@nvidia.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] app/testpmd: fix the sample RSS issue 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 Sender: "dev" When the RSS with null key was set in sample actions list, it caused the segmentation fault since the RSS key pointer was NULL while did the memory copy. This patch adds the RSS key NULL pointer checking before copying to fix the segmentation fault issue. Fixes: 11b1b0eddade ("app/testpmd: support RSS in sample action") Signed-off-by: Jiawei Wang Acked-by: Viacheslav Ovsiienko Reviewed-by: Ferruh Yigit --- app/test-pmd/cmdline_flow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 0618611..64c0e0f 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -7885,7 +7885,7 @@ static int comp_set_modify_field_id(struct context *, const struct token *, rss = action->conf; rte_memcpy(&sample_rss_data[idx].conf, (const void *)rss, size); - if (rss->key_len) { + if (rss->key_len && rss->key) { sample_rss_data[idx].conf.key = sample_rss_data[idx].key; rte_memcpy((void *)((uintptr_t) @@ -7893,7 +7893,7 @@ static int comp_set_modify_field_id(struct context *, const struct token *, (const void *)rss->key, sizeof(uint8_t) * rss->key_len); } - if (rss->queue_num) { + if (rss->queue_num && rss->queue) { sample_rss_data[idx].conf.queue = sample_rss_data[idx].queue; rte_memcpy((void *)((uintptr_t)