From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id 1D3EC1B45B for ; Thu, 2 Aug 2018 13:18:51 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id y9-v6so2075707wma.5 for ; Thu, 02 Aug 2018 04:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EOrgg7n6CGCQu5RCsqEbUUfaHPPrVZVc9ih6Yg4Rn+E=; b=Fu3wtmIb6c6rXuNIfLxMqNKhDpt8pjhEE8fh6PWcYUSt/Po7diWj4c+YRZSnfgUlYQ KZA2ryoAivGmwVx7vAlmghRJgp5iZ7V12+I3z2axJ3VtZzsi51KKS13sbWQxGx2weRLg BLQ/PVR6KHoH3GKPQxLQKduY3QsJIMsaGcDyo5nL2N5e7NLaHCrnbnNGLA/mXuBpr4Mk fLZenRSGJRJxxpj0ISYEFYYt/d75krgxfouWsI+4kAgmslhkj0kgq/JSTbxxICOh2D9C mtOQRLbMIbyJM1n4KWVOK2O4QJepHNt+An6kgF7IDz91rHPhtrJTMSiB1rMBRK8+T+/z INGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EOrgg7n6CGCQu5RCsqEbUUfaHPPrVZVc9ih6Yg4Rn+E=; b=acRNhF3PQVkvj5Sy2WP31RMha7U1Lm5PA9I2AcsdRSoNrxHvH2giE11M0Y72Gy0Bou gQoIMQ8ZtAV92l6+CEGdNYfryGxnw52DRm5DQZDMUDvmvS/ljwjflOOMrbP6Ag51eInx 8GlvvFKOlKFnVHn1VDXvgD7bH0SbRbvp4ilU/O0mQOcB9ZLpLaOPwdZsmhKbGXrjREdS QWfmHgufcNausmdaVkkaQcJR2an35xbPWv85TRcKoammdZc38VpKJYhRE9RGT82IcM/M ZUvsESaHkcNRT9nB0zeH+IwBteUGPCFPegM0yO5oTW4ucCWM1YiAjWb0iGl+cVLyxn0G iMsg== X-Gm-Message-State: AOUpUlFdL8IHlcPxou2gwyJedDuCa2FZ9SU2smOUZrBjWPfsS2Vzh096 zVW+ooW0vLRsn/vzRlII2WZpTw== X-Google-Smtp-Source: AAOMgpfjbcxYovv11wWhUglSjBuWsvPe445GpDU55mZO13RcTG3GE2tz1JGXRtFBquyH0FMRMtR1gQ== X-Received: by 2002:a1c:ee9a:: with SMTP id j26-v6mr1665586wmi.116.1533208730945; Thu, 02 Aug 2018 04:18:50 -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 r12-v6sm1095777wmc.27.2018.08.02.04.18.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Aug 2018 04:18:49 -0700 (PDT) Date: Thu, 2 Aug 2018 13:18:33 +0200 From: Adrien Mazarguil To: Moti Haimovsky Cc: shahafs@mellanox.com, dev@dpdk.org, nelio.laranjeiro@6wind.com Message-ID: <20180802111833.GL5211@6wind.com> References: <1533130807-9183-1-git-send-email-motih@mellanox.com> <1533199267-9658-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1533199267-9658-1-git-send-email-motih@mellanox.com> Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: fix RSS flow configuration crash 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, 02 Aug 2018 11:18:51 -0000 On Thu, Aug 02, 2018 at 11:41:07AM +0300, Moti Haimovsky wrote: > This commit fixes a segmentation fault observed when configuring > mlx5 with RSS flow rule containing invalid queues indices such as > negative numbers, queue numbers bigger than the number Rx queues the > PMD or has no queues at all. > > Fixes: 592f05b29a25 ("net/mlx5: add RSS flow action") > Cc: nelio.laranjeiro@6wind.com > > Signed-off-by: Moti Haimovsky > --- > v2: > * Modifications according to review by Adrien Mazarguil. > in reply to 1533130807-9183-1-git-send-email-motih@mellanox.com Almost, there is one new occurrence with the same issue, see below. By the way, like for "types" and "level" fields, a zero value in "queue_num" could be interpreted as default in order to target all configured queues, for the convenience of applications that do not care. This is not explicitly documented so it's just a recommendation though. > v1: > * Added check for zero queues. > --- > drivers/net/mlx5/mlx5_flow.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index 6c3021a..5576044 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -2065,6 +2065,11 @@ struct mlx5_flow_tunnel_info { > RTE_FLOW_ERROR_TYPE_ACTION_CONF, > &rss->key_len, > "RSS hash key too large"); > + if (!rss->queue_num) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ACTION_CONF, > + &rss->queue_num, Here ^^ > + "no queues were provided for RSS"); > if (rss->queue_num > priv->config.ind_table_max_size) > return rte_flow_error_set(error, ENOTSUP, > RTE_FLOW_ERROR_TYPE_ACTION_CONF, > @@ -2077,6 +2082,12 @@ struct mlx5_flow_tunnel_info { > "some RSS protocols are not" > " supported"); > for (i = 0; i != rss->queue_num; ++i) { > + if (rss->queue[i] >= priv->rxqs_n) > + return rte_flow_error_set > + (error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION_CONF, > + rss, > + "queue index out of range"); > if (!(*priv->rxqs)[rss->queue[i]]) > return rte_flow_error_set > (error, EINVAL, > -- > 1.8.3.1 > -- Adrien Mazarguil 6WIND