From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C7D68A0C49; Tue, 20 Jul 2021 09:53:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AA22C4068F; Tue, 20 Jul 2021 09:53:56 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2076.outbound.protection.outlook.com [40.107.237.76]) by mails.dpdk.org (Postfix) with ESMTP id 812A84068B; Tue, 20 Jul 2021 09:53:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lHOnNPB1PqaYYFpSMIS/pZ6Oy5qKFELCbNc7Gnb5z8Jq7khmQR1Of+SH1QKsi2gvigTyOon2fZEPxc8kWlcgzyWHVpFLSnvA9wpjXs/Ph/liVj6Fc2bUq/+r85LbwEe7w0mgsCOxB4AVKxJ75cr0vPV/43hAFw+0KTW/H9KEpm17/9x4ADRM8oVYzQflo/NyfMltUCZr1upzzl8MUM/nh79agE+GKLm5vOYuGoL0H2FKliCAqzUkc2Fahu+gYvV2+h1E4WOK6Ex3wEGOlFUN1kdghxbbKNKd3/G7HgcqNtdoB7aXIMXFVEZC/wlYIb062BWmo+vLvlm99Wuvrdu9ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=25v71j0bOiJqgBKCEVDVfwSe0RDkzjIY25NOaTpyiXc=; b=EiIY02h7nKOoXaLS+7h5igH5muUREetZ7VvNDfjgJfEVOJl0pLIKTQWK0zUIOlFDEKF1nmch/obLQwlnNH4VC+pMgtEQWFMo87uHlFp1OCCdM/VAh9NJu978dqQcAaFsnFxLPTkV8wRxJDwwUYmmgSejcToWJwfmqQVt9pH1L+g5ns4hSuPuaQy8xRat+1i814YBwwshp8sjMO610rKheW24jCAhQIwriIwPs19IDvPt2L1I5I0W9II3EjhVVMCcbQUPr20y1tkvxScuMDFZ1rx3yqQDm8OUMW8AxUuzl25mEQnX03iRA8j2IlhFAxlXU6xo2IjKjR3tDDleOZGEwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=25v71j0bOiJqgBKCEVDVfwSe0RDkzjIY25NOaTpyiXc=; b=W7EFkgBZHHeavSCT0tN3pUP3tGSzVqhCMxXGZD2UEfePIWJ2S0OOz55yyTdzhgqlySwd3C8kEoae041Lb6o/20P3N306M7mXECU6c9BlCgDmIUJefaD9+f0ZpSk5cDdJl7TwIIqM7T0gfH9fyxWbSYNh70w7p2g1JJFywBwwKLHiOYQ0C/m3gT0Vk3x0nbgWm09sYSqRUFkjGRxOpuMdkDBIj6yk8GLn4qJW1dFVRg18l/DALhcomLWauXy9wKwO+v3b58YfoAm7pFm3iXR6YVzKzkDDdTTHXT086R74OQuTFZ9ESct+AeBUlIYZpiWP4N5rl8BLkj7yVmPZStE8Iw== Received: from DM6PR02CA0128.namprd02.prod.outlook.com (2603:10b6:5:1b4::30) by DM5PR1201MB0169.namprd12.prod.outlook.com (2603:10b6:4:55::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Tue, 20 Jul 2021 07:53:53 +0000 Received: from DM6NAM11FT011.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b4:cafe::fb) by DM6PR02CA0128.outlook.office365.com (2603:10b6:5:1b4::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 07:53:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT011.mail.protection.outlook.com (10.13.172.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 07:53:53 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 20 Jul 2021 07:53:51 +0000 From: Dmitry Kozlyuk To: CC: , Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Date: Tue, 20 Jul 2021 10:53:35 +0300 Message-ID: <20210720075335.2742271-1-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4f9b7f85-19ff-44f9-a972-08d94b5384dd X-MS-TrafficTypeDiagnostic: DM5PR1201MB0169: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PWc9kjyjynC3mzfJXKx6FmoZ82gop/nbeG3JW72RIgNkqVf3hhSHIRbAM0Beg0uFnGQtvcTrYng0sMd+sUUsg8imjrFTlA8z/P9IcG0iGyK0vOSFmY/iZhmmno5PBew3osADbe/3pYUJ/EMJ0DsW/Cb03/KixYDLtJgyoJnHAwRjmjrCG9tKodK08TeH8/o6U61JmzQdahfKgP/fXfycGA9NbvElsaG4tmcfcWAd0uAg/ksIPzjKaCIg155guQnGJathKUtwzZZ2mavumm4xhfXIzcZMY3NNeUFO6ekSIEOMY6Zq+ArU/ER878C2/71PkbvcwX/TjKGuBk5EIK8xJMyV1lY/r9J7qkke7oqlpcf146y5AmKIQtBZL/vIrgK6DVjALNZcGrgJKhY2priTNeOkZcsJdGbpyjr482nF9N8cZKhQkHmtz4ADMLZq/XMSUTwPo4a5TJQmn/BtHyvDR9qKjWEeaYod1jd5NSx32TGgxKQqLlVbAetiG6n+L3MXfrhM7hHBRDyrX8A1aL+9QR2SJpsa5iKXHgzO+1eR/bnUKjyGEf2RArxk7eWjMuypGFQtTvDZqgosFg7TLUb/ohvIIZa4/PFHrYlXL524Lt9ALZO0enJIIMxocaxpq4OapeqCs1W4tPljvRC+cGoqZkjCcFm73TNWuuGJFtwsyMAXD9XSftCZg6221nzslOrP59Ao568QmFHrHbSUpbv1iQ== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(376002)(396003)(136003)(346002)(46966006)(36840700001)(36756003)(36860700001)(6286002)(8936002)(16526019)(186003)(82740400003)(356005)(47076005)(70586007)(82310400003)(7696005)(26005)(7636003)(6916009)(4326008)(8676002)(83380400001)(336012)(5660300002)(2906002)(55016002)(36906005)(70206006)(316002)(107886003)(1076003)(2616005)(478600001)(54906003)(450100002)(6666004)(86362001)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 07:53:53.2044 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4f9b7f85-19ff-44f9-a972-08d94b5384dd X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT011.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0169 Subject: [dpdk-dev] [PATCH] net/mlx5: fix invalid Rx/Tx queue checks X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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 device configuration was interrupted by a signal, mlx5_rxq/txq_release() could access yet unitinialized array and crash the application. Add checks whether queue array is initialized. Fixes: a1366b1a2be3 ("net/mlx5: add reference counter on DPDK Rx queues") Fixes: 6e78005a9b30 ("net/mlx5: add reference counter on DPDK Tx queues") Cc: stable@dpdk.org Signed-off-by: Dmitry Kozlyuk Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_rxq.c | 2 +- drivers/net/mlx5/mlx5_txq.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 23685d7654..afe77e612d 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1712,7 +1712,7 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx) struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_rxq_ctrl *rxq_ctrl; - if (!(*priv->rxqs)[idx]) + if (priv->rxqs == NULL || (*priv->rxqs)[idx] == NULL) return 0; rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq); if (__atomic_sub_fetch(&rxq_ctrl->refcnt, 1, __ATOMIC_RELAXED) > 1) diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index 3e5e94444b..d3b9de7c7a 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -1246,7 +1246,7 @@ mlx5_txq_release(struct rte_eth_dev *dev, uint16_t idx) struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_txq_ctrl *txq_ctrl; - if (!(*priv->txqs)[idx]) + if (priv->txqs == NULL || (*priv->txqs)[idx] == NULL) return 0; txq_ctrl = container_of((*priv->txqs)[idx], struct mlx5_txq_ctrl, txq); if (__atomic_sub_fetch(&txq_ctrl->refcnt, 1, __ATOMIC_RELAXED) > 1) -- 2.25.1