From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20068.outbound.protection.outlook.com [40.107.2.68]) by dpdk.org (Postfix) with ESMTP id 2A0CA1B45D for ; Thu, 2 Aug 2018 10:41:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AzBD+vz4VWSCv3wRDepzkbLXg9mosAG9C3rAfe2Oqy4=; b=gyK7XqjsP9sTUZ3jO3zOD5uhrC1e3edMGRKI4NH+PrkwOFPhuvKRlKkxlEDwzH3ITQgd8B8Gr9EaxWYIefy496391xNUtVpfVfz75oVSdmc2PNICBiskoOBisfmMJBFR2eQ50sa4Ba95mCToARoOxns4hn/NVOWuYaFdBVym5gs= Received: from localhost.localdomain (37.142.13.130) by AM0PR05MB4434.eurprd05.prod.outlook.com (2603:10a6:208:5a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Thu, 2 Aug 2018 08:41:36 +0000 From: Moti Haimovsky To: shahafs@mellanox.com, adrien.mazarguil@6wind.com Cc: dev@dpdk.org, Moti Haimovsky , nelio.laranjeiro@6wind.com Date: Thu, 2 Aug 2018 11:41:07 +0300 Message-Id: <1533199267-9658-1-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1533130807-9183-1-git-send-email-motih@mellanox.com> References: <1533130807-9183-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: AM5PR0701CA0022.eurprd07.prod.outlook.com (2603:10a6:203:51::32) To AM0PR05MB4434.eurprd05.prod.outlook.com (2603:10a6:208:5a::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d6d4c496-5eee-4d63-bad4-08d5f853c260 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4434; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4434; 3:psypIoj7c9TrZMBz+NdWY5zONuc4Gjw4INDROSFDBk5rTCz4Qk7KO3x05ftEckbtqtxSMNm247g16QNdoKQchDpkS2ZGVMk9egFe7x82oOTqKUetFja14CA7B5pj/vOTF94JN0wWX7Mic8VjSc32pvHzofZ6DfY48NQahcYfX4GVMaZYZb24cfnzzcr72NdDpQ3bM5nuvsh2ft7Pf/QhuxlP7QteM5MwpjH/EZLt36qZjUvLlHXTp91F+E7+WqCI; 25:6+U4yh+VnLutix3eofFrcTXCrDBahWtE/wPrZk5OE0gM5a3NSfSt8WOBmgqM4t7fuPFS/d6L5RLhPrF0+ybYG0G98byRiOPLfdU+TzObnKpFxsDqbdMNbDs21gYZZFjtixl7gN7UgfFsn32jBIvJXp7WGRqYmLE6iK77R86dckhUTiMtHqfo+vzrh4yabHi6Q6ckkb+LslCk3J+6nP1KPWTmw8RABYD/Zog3EwFFZBRRzu/WZ6Q13npMV5fExs0YtXjQKcDNVvz7nSBgXEgaPYw449SvCVyEH+ZibgAucyAGd5zx+h611OAKwFnMh6Juor9Jkml8LmtpIDYZiHG4wg==; 31:682RPq8uwxv5Oanf+j1iSzXNuWazqyW4c7ZnEeOKguzmnVRvzi8GSu3kTeZVUBFp8Nbt4xYTLfN9u2ENTsCFEcVc18s99aChvr+Cg5Btxo8rPLfwvyIQ6GTXv1enMfkOUtQfiX7t9qOWMKsHfNSB5NYSDOcy1nw1lq1Y8PCOhAJEQMRkFUFSsgd629KnyOTXbdG1o4cLwZPWBFrlGfv/kdtGoaFokdBeRmexvHsosK4= X-MS-TrafficTypeDiagnostic: AM0PR05MB4434: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4434; 20:uEnPjLHSD6uw0niqlpB/NDlcXNcwMxlmEw6M1OgwBzuWz1DTW0HtA4wRzKARn9IwMbs+0L1xet3ci5oGZ6Yzn43uUGBDhhHxLy3yTQcY0l2ki+B8LoeqLwUpIw1Cw7SQfX5Z5RSClFCBbf8viFwTQAWzBp+kNHtE69bW7QIW5LU2hNzdHWlo8RUNdhIxQ2ZlspYOlGiZD94yOgO7mWnhHFxfIdfoLjmJlwUC14QUKqry+mPyQnJ6jOG8hWOzY9TPzG23Dg0Ol5e6PGsI748wmNkoEBdkhDL9YdoI+8Fwtcf9ikVDDJElHBaTnqaAIk2NGBXZDkr/EAhS2uE2eur/MQIiGzbevARP32/6cqsX5Ryh9RL4dPjZ/LM0NypStU151Yxj5X4TygpYcUwvZqn3+yDFPUE0ax1MIaN1qlJqMt9Ltx8Ah4BUe7niiiDafM9O6jrkNMSc1zlApt5pGtfyNKvj6DSoniH3ufMgpAqt7RGhgC9bvQtSK441kygKewN7; 4:6kRf4chG0NLPG//xzWaDrQj0OO3A5lr7Tse0PTevlUCRf1DSGq6Km5N1WpIeg3lFO2wsdaK9eqoJJwWaeo2ew6zCXJ6OTBKHCBaryhydMBU+6c6XzS8fk7vBI1b1bKipi/JUvm6ugxjcM+rZDnf6rmnrsN0+Lx/N/RETBdh+Ngr10PrcWjeenJyU2ebJmudFZcCyByOgJe0SgdBdneZERK53EsZM3nZi39n7mF98MVOWjE2NigtMK3kvi0UgS3+YKEf0YgrqK+tH8io2Vxy0cw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:AM0PR05MB4434; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4434; X-Forefront-PRVS: 07521929C1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(136003)(346002)(39860400002)(376002)(396003)(366004)(199004)(189003)(76176011)(51416003)(6512007)(86362001)(6486002)(2906002)(81156014)(8676002)(36756003)(7736002)(105586002)(305945005)(68736007)(8936002)(50226002)(52116002)(106356001)(478600001)(81166006)(4326008)(956004)(5660300001)(53936002)(47776003)(25786009)(476003)(97736004)(3846002)(16586007)(2616005)(6116002)(6666003)(316002)(16526019)(486006)(386003)(26005)(6506007)(446003)(66066001)(48376002)(50466002)(11346002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4434; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR05MB4434; 23:N56cKXphD9uYvDISj28NiicDZ2T1jzD1fIFE7S7OZ?= =?us-ascii?Q?mZ+4kH6UEUzplWJMeq5aVOXH4XyeWkk6szVtTz0RvjmA7AzgDk/bf9c3ysz2?= =?us-ascii?Q?9opr0KU/jV0f58uY7YhBC+bH1TofLlgK/HB1KgfEace0i7xza/FS/Y9XG407?= =?us-ascii?Q?XfocccthULO2H0LATxaeJ2q4xhIbK4rEdyK/HH2/pnrUTnAOqX0NxR0STALw?= =?us-ascii?Q?RBPGVqO1ALqU7Ai/SzkGJ3eXOq9KZ9gy5X6dOf+vdt6uQru1GDbObmrdQh2D?= =?us-ascii?Q?fau0LUKKRFHU8B83E0EvqRUVt+BRIvmj7eijWbl1SF1YUEUYmVPtLWg4EVP/?= =?us-ascii?Q?xn7KFKUSDJbTOkWQ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dWiwm3haDH05Cwr2++XqHz+5W9oK0o94nM1aH2lQtgnX2l2Y35yeZ0/HGgrQuIjyryIcpPhKaP0Rn5SDl/t4j49ZUxmhxpfMkHPtqgTSQfEY6ENdTXxcT9Uw8uL0g8MHvoj+ysVbdj40V7uCVb4sGZBgEq94cOd SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2018 08:41:36.2941 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d6d4c496-5eee-4d63-bad4-08d5f853c260 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4434 Subject: [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 08:41:38 -0000 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 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, + "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