From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20083.outbound.protection.outlook.com [40.107.2.83]) by dpdk.org (Postfix) with ESMTP id AFEAE5F3B for ; Wed, 1 Aug 2018 15:40:37 +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=CFLQKJAYxrLwzEJPj6NSh8lkY0iEgh4rP2Sfu5fx0u8=; b=WK1x124PBwvgpFS85pTZZLBOTs23+Rl/9UKQgMWqUBIEbIRrGV9mgESplZAKVO6Vx69SjGDYhYcDHi0J3AlUOJStAw7d9OdjqQ5iJWIE+n+lvAKJqIkUIoa8TRZx6qXqdrQMQlRF8jSRJvKrnoXvl47U4ss1ExL3pVvQ2+lBdas= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from localhost.localdomain (37.142.13.130) by AM0PR05MB4436.eurprd05.prod.outlook.com (2603:10a6:208:5a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Wed, 1 Aug 2018 13:40:35 +0000 From: Moti Haimovsky To: shahafs@mellanox.com Cc: dev@dpdk.org, Moti Haimovsky , nelio.laranjeiro@6wind.com Date: Wed, 1 Aug 2018 16:40:07 +0300 Message-Id: <1533130807-9183-1-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1533120218-32538-1-git-send-email-motih@mellanox.com> References: <1533120218-32538-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR06CA0154.eurprd06.prod.outlook.com (2603:10a6:7:16::41) To AM0PR05MB4436.eurprd05.prod.outlook.com (2603:10a6:208:5a::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f80fb00-7dab-43ea-3e08-08d5f7b45cca X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4436; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4436; 3:2saOSeU1VbuXu+4/vb+YbXnW2e5Nj4Y43B29ooNs6HW4tq6HK9zYO/ZZjuKoZCF4iM4fQ6Imb3/2p7xgm8FMULpcB68PE4vYRx0MicUZXnahnFUJljNBelQdIYi6aiuLpPL0Bklx4fvMVKc130HLmscqA/eXg25SHBAoCrpMhNQkMrMGf6hAK509bU9p7Hp50rOawPvuvqsCPfk9L9pFXYh2kVjYsKUg7N1zu4vhK1YUqC7RmAESGcvEU6RVzXKH; 25:iY1H/UpxeZWFxK/+Ud+LUU4cJ0uaDo9NICTqE1qoFzBvr4rSluXJxVB0+hOZctyDbWZF0LNXaKbByK+snxpMKf1r5W1mpm2+0JGaQRJ0O1I2nMwCd/6BRlKGVBkaxQOxT6ZUasjN96ff0pwns/0/H0QXg6nI+wvQHE7I5JAXuNU+SI7zrmEDqQYriXZotmVV0IZ9BxC8bHkR/YUBGaQ0HVPygawLfy9UHCwuoyQjysbPSlKGXx/QToPe5irpnhOTo7LcwlCnPcNUUEqSdKtqVRAwEB0FJwxLYIgjO8hkaXhWynOjKdUj0QHXFYylt8aJzE+k9DVBhT66lQlCnVAnAw==; 31:6XLiELMLeqaL9WD3XuojovCV8Psl7pRe0bvfK5HJ8ziOOHebcIrED/9R1gwHUnREsrn6qIV9WWNp9wexClWQCVk6HkbG55WyI+nqDhGOH9LUgbEEMjVMicS+bqkZuqWPY+tAgpJmAH+0xelXP1JPCCCtwo2PGvRoZ5G7jI/y6rLsRG9NKwjlNBV9ZdPP54jDQF3EIgSGnOyPFUH90cUVaeVuxtctU18W66tKAk5nKyY= X-MS-TrafficTypeDiagnostic: AM0PR05MB4436: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4436; 20:KigAJzDZiqsytjLvRJMyBmcURw83Cwuo6dCVsH1KRgaghu1737H1dqnNtaugHwwV2rD2ru7M2kSsxcqaTlwYqtGYFfj5R1ERHiecLzs6VJFfIx9zdETdxnf/H0xTklZJxl2/IWC/wZdAjCRzahWHGeZEA1zZqutXIMMT0m9808UEG0gBRaK4uhgYjTV2IZjZEaA0vi0uGkPhDyveMWwOSiBMksbcSo7SPAoxWYfBa+4BxaavNPYqmtYkEwbywysVseMleDhXUnD72TeZRNSytF7rOh7UUXNBjX7tsvisUdjSvAumcdJTpXZyPU5cyZiiU0M3MhTu1rr0V7r/34cY9KoCGjlmduovVNN3TDom44732ZbERNfpmZmqBR2NvpQ7F7Ipkz3ZuPM0RVp2s/zhvPyCgfBtp4smov5ArZBjEH31tTZffkP0RYUjgmhs6ppwaHG9unZJJpfTLgPrBRhYGC9bb08+sOJ3eoLk/aO90NaL2qYlODzLq/P00nF9vKJD; 4:7EbOS32ItanntxqEFDVQi2v2wz2hSH9YwLLgnTJYzHPZFrNOQEPkzB8zImV2F6C0nzJu7dwqrJbgo2qHmRha30PBrmBI0pACuZZV6XQUv5Uo1teK/9GHGmhDFIx6lFcqPVTC06nnAxBJ0DRUzLt8YPa2fOES3uChF7UXkfUtyakbuzmJ5ptC7pKwL+6ThAipZzoexbGJ053QvYy7hEBGkZhd88uMi0u6xQ2fYAKP3UrxP3Ek9U8ksC+iDgHXlQ8puK8CNCPniCo8wwIQWgzWJw== 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)(3002001)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:AM0PR05MB4436; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4436; X-Forefront-PRVS: 0751474A44 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(396003)(39860400002)(376002)(366004)(136003)(346002)(189003)(199004)(86362001)(81156014)(386003)(11346002)(34206002)(316002)(8936002)(2351001)(16586007)(50226002)(956004)(476003)(486006)(6116002)(3846002)(2616005)(81166006)(76176011)(6506007)(105586002)(52116002)(50466002)(8676002)(53936002)(106356001)(305945005)(2361001)(25786009)(48376002)(6636002)(37006003)(6666003)(7736002)(4326008)(51416003)(97736004)(478600001)(6486002)(6512007)(68736007)(16526019)(446003)(36756003)(2906002)(26005)(47776003)(66066001)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4436; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR05MB4436; 23:7dQ1b1XQZvzsATTJE+s1ZacR487QJtPbwj3KuIG+8?= =?us-ascii?Q?gTC9qs5b3L0bk9d581Ik1aknL7gnykl8X0aexIJpqs2fPZvtXW0MikGh/yGF?= =?us-ascii?Q?frxCIZTzq3UUsRP+OuFPB9rvqyuHzm6tzBePTOdcXaAjGQ10/XQr8cRow+uf?= =?us-ascii?Q?phwcfkX+UVdAClW+us2N5nI0k9YIswprmAalY46a7vsN1gkRE0oHCoOLRe9r?= =?us-ascii?Q?e8CHpQyhL509eybVJLPN5xHkgQSX9viGK6qAC+J8xgwvKr8jYgGg7w/TuOC+?= =?us-ascii?Q?h60Ka+rb9Ku903ZW8dHnHbhzWq3ZefKSOTuweHHqPM3Zd+mEyUS4Mgd18kgn?= =?us-ascii?Q?FLw9DDB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azlaidr+UsFDQKqV1cEwbtPsz5njfPQEjXCSvEIV8=; 7:CTMHp3P6JdCQMpbclQkR6TFiWKpXWLaQNaC2hpmGvy2QkGHnuOqj6cgQ+jj9GHvylO1Uwj45U/ekh+3jUGegPzJvHsh0IuVn1+BPdmMO03nBJvi0UIXtbAs3dnKp60bnkXk7f9Hmk1+O6gtC0yJb/iioXpTJtAWFnL1Khpmg8IcGSCXk8o0LzQBBNfRKX6t9VXcXigGIkPLF7IJAfHPIay8708MSpBAWv/NVse12JGSOtE4j9pzNN1CYDEYIqVgW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2018 13:40:35.6418 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f80fb00-7dab-43ea-3e08-08d5f7b45cca X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4436 Subject: [dpdk-dev] [PATCH v1] 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: Wed, 01 Aug 2018 13:40: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 --- 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..d32b86d 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[i], + "queue index out of range"); if (!(*priv->rxqs)[rss->queue[i]]) return rte_flow_error_set (error, EINVAL, -- 1.8.3.1