From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f171.google.com (mail-pf0-f171.google.com [209.85.192.171]) by dpdk.org (Postfix) with ESMTP id D82632BE0 for ; Tue, 2 Aug 2016 21:35:24 +0200 (CEST) Received: by mail-pf0-f171.google.com with SMTP id h186so69066343pfg.3 for ; Tue, 02 Aug 2016 12:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bigswitch-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=IX1LA7U6neX10xosSvP/rJlaikZdahw5QVnm6SCdEzY=; b=0FkxoyMtU3DG7m3W7B4XIxAMK6snTh9HaLsuDvsZAfBq+dDrDHv6GTSBWWtTu/gBQy ETZsGYtfTvFKYGaLMAonsuJGLgGSyItMkq7g7mEhmLj+XDzTGY2EYaEJQ1MKt9aS9ras t2b4B6v3QbbyPJCN3X9d57eH4wMvkM1D3LQiYAvXDaWsW0OPefDL5YKuIvHxv5FcGcSO 3hj86CnlX5HdCXAPYWBY//TgqGNXJxdeEZp75VMdiy6hbjt/zh92NV/OuIBGla54OYAK vOlHuqMw9P0jqcwtEEKIj/OIRRj3yyC22eosvRfaSK+9g5gIJ/xTfrYrJA39Qm3Yj+SO BPJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=IX1LA7U6neX10xosSvP/rJlaikZdahw5QVnm6SCdEzY=; b=mU7PITkgusZLLQ0ldRmxD9v1Oi1B+kNMpuyk8hZEeSUg7ACcKdDPRM0pZ2O5FRimyB wZwbAibrYS863wLIyOXMXQ3aAvwh9EQgM3sdKfagQYY5uifZ/u8AvnE2K3GzrVwqLTmX wVxvKtT8h57wjp0jLdPY8+FotBemuoGy0aJU79lsZ3tmgiSLdOq+7g0XUC1nJQxVkRGF KoEAsSfSkd9hbMnkcbPDsih5HoHAn3mEROtxzH28TcdoKBpZnb8uTyuW5rbb69YfpbH9 F5Swp2njBqqmmMa/ikg7bO/vV30ahWQJTUNcxdH+fPkWJVrf6U5Uemg1xQP/CcjrASBI xjvQ== X-Gm-Message-State: AEkoouvu2/Q7TwVXdBL4zCiIYnwI5+amMHCugcBu7AexXxlNH/h/5w7AlcPofLxDt0lqMSFP X-Received: by 10.98.54.134 with SMTP id d128mr109363570pfa.150.1470166523886; Tue, 02 Aug 2016 12:35:23 -0700 (PDT) Received: from rlane-work.eng.bigswitch.com ([173.227.38.50]) by smtp.gmail.com with ESMTPSA id 5sm6726971pac.34.2016.08.02.12.35.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Aug 2016 12:35:23 -0700 (PDT) From: Rich Lane To: dev@dpdk.org Cc: Helin Zhang , Jingjing Wu Date: Tue, 2 Aug 2016 12:34:56 -0700 Message-Id: <1470166496-70610-1-git-send-email-rich.lane@bigswitch.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] net/i40e: fix null pointer dereferences when using VMDQ+RSS X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 19:35:25 -0000 When using VMDQ+RSS, the queue ids used by the application are not contiguous (see i40e_pf_config_rss). Most of the driver already handled this, but there were a few cases where it assumed all configured queues had been setup. Fixes: 4861cde46116 ("i40e: new poll mode driver") Fixes: 6b4537128394 ("i40e: free queue memory when closing") Fixes: 8e109464c022 ("i40e: allow vector Rx and Tx usage") Signed-off-by: Rich Lane --- drivers/net/i40e/i40e_rxtx.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 554d167..0556a4d 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -2948,11 +2948,15 @@ i40e_dev_clear_queues(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); for (i = 0; i < dev->data->nb_tx_queues; i++) { + if (!dev->data->tx_queues[i]) + continue; i40e_tx_queue_release_mbufs(dev->data->tx_queues[i]); i40e_reset_tx_queue(dev->data->tx_queues[i]); } for (i = 0; i < dev->data->nb_rx_queues; i++) { + if (!dev->data->rx_queues[i]) + continue; i40e_rx_queue_release_mbufs(dev->data->rx_queues[i]); i40e_reset_rx_queue(dev->data->rx_queues[i]); } @@ -2966,12 +2970,16 @@ i40e_dev_free_queues(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); for (i = 0; i < dev->data->nb_rx_queues; i++) { + if (!dev->data->rx_queues[i]) + continue; i40e_dev_rx_queue_release(dev->data->rx_queues[i]); dev->data->rx_queues[i] = NULL; } dev->data->nb_rx_queues = 0; for (i = 0; i < dev->data->nb_tx_queues; i++) { + if (!dev->data->tx_queues[i]) + continue; i40e_dev_tx_queue_release(dev->data->tx_queues[i]); dev->data->tx_queues[i] = NULL; } @@ -3154,7 +3162,7 @@ i40e_set_rx_function(struct rte_eth_dev *dev) struct i40e_rx_queue *rxq = dev->data->rx_queues[i]; - if (i40e_rxq_vec_setup(rxq)) { + if (rxq && i40e_rxq_vec_setup(rxq)) { ad->rx_vec_allowed = false; break; } @@ -3216,7 +3224,8 @@ i40e_set_rx_function(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_rx_queues; i++) { struct i40e_rx_queue *rxq = dev->data->rx_queues[i]; - rxq->rx_using_sse = rx_using_sse; + if (rxq) + rxq->rx_using_sse = rx_using_sse; } } } @@ -3255,7 +3264,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev) struct i40e_tx_queue *txq = dev->data->tx_queues[i]; - if (i40e_txq_vec_setup(txq)) { + if (txq && i40e_txq_vec_setup(txq)) { ad->tx_vec_allowed = false; break; } -- 1.9.1