From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from stargate.chelsio.com (stargate.chelsio.com [12.32.117.8]) by dpdk.org (Postfix) with ESMTP id D7F764D3A for ; Fri, 9 Nov 2018 08:57:57 +0100 (CET) Received: from localhost (scalar.blr.asicdesigners.com [10.193.185.94]) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id wA97vsuo014835; Thu, 8 Nov 2018 23:57:55 -0800 From: Rahul Lakkireddy To: dev@dpdk.org Cc: indranil@chelsio.com, nirranjan@chelsio.com Date: Fri, 9 Nov 2018 13:26:28 +0530 Message-Id: X-Mailer: git-send-email 2.5.3 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 6/6] net/cxgbevf: fix illegal memory access when freeing MPS TCAM 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: Fri, 09 Nov 2018 07:57:58 -0000 Individual MPS TCAM entries are not allocated as separate entities. All entries are allocated once as an array. So, fix bug with attempting to free illegal memory location. Also add missing MPS TCAM initialization for CXGBEVF. Fixes: 6fda3f0ddda9 ("net/cxgbe: add API to program hardware MPS table") Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/cxgbevf_main.c | 6 ++++++ drivers/net/cxgbe/mps_tcam.c | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/cxgbe/cxgbevf_main.c b/drivers/net/cxgbe/cxgbevf_main.c index 6223e1250..61bd85193 100644 --- a/drivers/net/cxgbe/cxgbevf_main.c +++ b/drivers/net/cxgbe/cxgbevf_main.c @@ -11,6 +11,7 @@ #include "t4_regs.h" #include "t4_msg.h" #include "cxgbe.h" +#include "mps_tcam.h" /* * Figure out how many Ports and Queue Sets we can support. This depends on @@ -271,6 +272,11 @@ int cxgbevf_probe(struct adapter *adapter) print_adapter_info(adapter); print_port_info(adapter); + adapter->mpstcam = t4_init_mpstcam(adapter); + if (!adapter->mpstcam) + dev_warn(adapter, + "VF could not allocate mps tcam table. Continuing\n"); + err = init_rss(adapter); if (err) goto out_free; diff --git a/drivers/net/cxgbe/mps_tcam.c b/drivers/net/cxgbe/mps_tcam.c index 02ec69a92..71c8070b3 100644 --- a/drivers/net/cxgbe/mps_tcam.c +++ b/drivers/net/cxgbe/mps_tcam.c @@ -236,8 +236,6 @@ struct mpstcam_table *t4_init_mpstcam(struct adapter *adap) void t4_cleanup_mpstcam(struct adapter *adap) { - if (adap->mpstcam) { - t4_os_free(adap->mpstcam->entry); + if (adap->mpstcam) t4_os_free(adap->mpstcam); - } } -- 2.18.0