DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiawei Wang <jiaweiw@nvidia.com>
To: viacheslavo@nvidia.com, orika@nvidia.com, thomas@monjalon.net,
	ferruh.yigit@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] app/testpmd: fix the sample RSS issue
Date: Tue, 26 Jan 2021 05:49:42 +0200
Message-ID: <1611632982-415500-1-git-send-email-jiaweiw@nvidia.com> (raw)

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 <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 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)
-- 
1.8.3.1


             reply	other threads:[~2021-01-26  3:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26  3:49 Jiawei Wang [this message]
2021-01-28 22:32 ` Ferruh Yigit

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=1611632982-415500-1-git-send-email-jiaweiw@nvidia.com \
    --to=jiaweiw@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=orika@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.com \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git