From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id 6B4547CD1 for ; Thu, 4 May 2017 19:08:31 +0200 (CEST) Received: by mail-wm0-f41.google.com with SMTP id w64so2726955wma.0 for ; Thu, 04 May 2017 10:08:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=ft5vjsFIfu0wHH0xDBfVYu6fWjg8Z+8PMBCOIX3fPgo=; b=z0PElW4Xdal2b7yP8XOzlNNPsBrfVer4vqmRKnEa0piSkFxLKRv3/5btGx05kb8141 eZPA4KBRFEvHKdMgCfn4pCJeQsm0TrfRtMFCbwMaX7jx+QkS/yASgeulgbRcBuMns/gR 18hoQ11HBJzSCemJKGsz+0mUe7z6vOQ/yIUwUxL684jyCvrUW1OJE4USVbmiZiJAK4iH Kuhd2UFIAWTLtlxPICQwLN/YQsbymahRwDpcGhHj3G1iO+kmNZbA3Qdij/9dYbh7zc0D aDFkbMDPCtq49/k5ScHyE3d9chrkan9dT+NctP0P5IVpUliju0ThimXzpgifIH3Ucs5P PaBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=ft5vjsFIfu0wHH0xDBfVYu6fWjg8Z+8PMBCOIX3fPgo=; b=svoy4CEabYxsgBy0ItTSxpW5HlmaVuh9NQcGRXf8bZS+1wdN1z10B1dBW7nt4Vc5ZH P5+i99SpuyJ1skA9KfxAx3eqVw56k/Fq2hl84RMNVXcQdnAr0p+OmEizJG9j37nZhwvH 3LfLq6gzswT/qZTktqumJYFaza+k7mZ6IYBGykuJ6Nc+Sp9fs7/Nq26J8f7Cv0Ipx5F1 W6MkHQARNjhD/g/5jctPc0t49QM7AJ03VCkOsTAYp09mkCy/inXWUMH/fWOLh8CJI8Tw IwlYo1YuxAibn35E1D2wLoZ/ohWZFnwu/Hnr5pk6Dnd+owYKYVTiwle6GFScW3Qz0UGO c6Yg== X-Gm-Message-State: AODbwcB+mWcDBn/TAIXi4z2QFDhZth4Vgktl3iZ8Qg4S1teB4Gq6RFot 1zqN7fBSzVk48SBWzeE= X-Received: by 10.28.164.193 with SMTP id n184mr2777688wme.107.1493917710460; Thu, 04 May 2017 10:08:30 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id i199sm1996387wmf.33.2017.05.04.10.08.29 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 04 May 2017 10:08:29 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Date: Thu, 4 May 2017 19:08:22 +0200 Message-Id: <76e59d59935ffccf9996c536866fcef64d6319b0.1493917362.git.adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH 1/2] app/testpmd: fix stack overwriting by flow command X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 17:08:31 -0000 The parameter type parser function stores a stack-local address in the global parser context when parsing a "prefix" keyword. This usually translates to "Bad arguments" errors even for correct flow rules as stack gets overwritten by subsequent function calls. Fixes: d3f61b7bad20 ("app/testpmd: add flow item spec prefix length") Signed-off-by: Adrien Mazarguil --- app/test-pmd/cmdline_flow.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 0a40005..e952c91 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -1808,6 +1808,8 @@ parse_vc_spec(struct context *ctx, const struct token *token, return -1; /* Parse parameter types. */ switch (ctx->curr) { + static const enum index prefix[] = NEXT_ENTRY(PREFIX); + case ITEM_PARAM_IS: index = 0; objmask = 1; @@ -1822,7 +1824,7 @@ parse_vc_spec(struct context *ctx, const struct token *token, /* Modify next token to expect a prefix. */ if (ctx->next_num < 2) return -1; - ctx->next[ctx->next_num - 2] = NEXT_ENTRY(PREFIX); + ctx->next[ctx->next_num - 2] = prefix; /* Fall through. */ case ITEM_PARAM_MASK: index = 2; -- 2.1.4