From patchwork Wed Feb 21 13:38:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ophir Munk X-Patchwork-Id: 35323 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EE4CC2C18; Wed, 21 Feb 2018 14:39:16 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 4A9042C18 for ; Wed, 21 Feb 2018 14:39:15 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from ophirmu@mellanox.com) with ESMTPS (AES256-SHA encrypted); 21 Feb 2018 15:39:21 +0200 Received: from localhost.localdomain (pegasus05.mtr.labs.mlnx [10.210.16.100]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w1LDd9QZ003003; Wed, 21 Feb 2018 15:39:09 +0200 Received: from pegasus05.mtr.labs.mlnx (localhost [127.0.0.1]) by localhost.localdomain (8.14.7/8.14.7) with ESMTP id w1LDd9fb019377; Wed, 21 Feb 2018 13:39:09 GMT Received: (from root@localhost) by pegasus05.mtr.labs.mlnx (8.14.7/8.14.7/Submit) id w1LDd8g2019376; Wed, 21 Feb 2018 13:39:08 GMT From: Ophir Munk To: Adrien Mazarguil Cc: dev@dpdk.org, Thomas Monjalon , Olga Shern , Ophir Munk , stable@dpdk.org Date: Wed, 21 Feb 2018 13:38:38 +0000 Message-Id: <1519220318-19328-1-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH v1] net/mlx4: fix RSS actions with no parameters 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When creating an RSS flow with missing actions parameters, for example: flow create 0 ingress pattern / end actions rss / end testpmd aborts with segmentation fault. In the corrupted code mlx4_flow_prepare() accesses RSS action->conf pointer without verifying its validity. In case of missing RSS actions parameters this pointer is NULL and must not be accessed. The fix is to return an error in such cases "missing rss actions". Fixes: 078b8b452e6b ("net/mlx4: add RSS flow rule action support") Cc: stable@dpdk.org Signed-off-by: Ophir Munk --- drivers/net/mlx4/mlx4_flow.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index 2d55bfe..7a127a8 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -735,6 +735,10 @@ mlx4_flow_prepare(struct priv *priv, if (flow->rss) break; rss = action->conf; + if (!rss) { + msg = "missing rss actions"; + goto exit_action_not_supported; + } /* Default RSS configuration if none is provided. */ rss_conf = rss->rss_conf ?