DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: dev@dpdk.org
Cc: indranil@chelsio.com, nirranjan@chelsio.com
Subject: [dpdk-dev] [PATCH 6/6] net/cxgbevf: fix illegal memory access when freeing MPS TCAM
Date: Fri,  9 Nov 2018 13:26:28 +0530	[thread overview]
Message-ID: <f3b01eeb9ee265377cf969db937b0037d09bbcd0.1541747960.git.rahul.lakkireddy@chelsio.com> (raw)
In-Reply-To: <cover.1541747960.git.rahul.lakkireddy@chelsio.com>
In-Reply-To: <cover.1541747960.git.rahul.lakkireddy@chelsio.com>

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 <rahul.lakkireddy@chelsio.com>
---
 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

  parent reply	other threads:[~2018-11-09  7:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09  7:56 [dpdk-dev] [PATCH 0/6] net/cxgbe: bug fixes Rahul Lakkireddy
2018-11-09  7:56 ` [dpdk-dev] [PATCH 1/6] net/cxgbevf: add missing PCI uninitialization function for VF Rahul Lakkireddy
2018-11-09  7:56 ` [dpdk-dev] [PATCH 2/6] net/cxgbe: check Rx offload flags before doing VLAN strip offload Rahul Lakkireddy
2018-11-09  7:56 ` [dpdk-dev] [PATCH 3/6] net/cxgbe: fix check for redefined match items Rahul Lakkireddy
2018-11-09  7:56 ` [dpdk-dev] [PATCH 4/6] net/cxgbe: increase completion wait time for flow operations Rahul Lakkireddy
2018-11-09  7:56 ` [dpdk-dev] [PATCH 5/6] net/cxgbe: fix wrong ingress port value set in filter spec Rahul Lakkireddy
2018-11-09  7:56 ` Rahul Lakkireddy [this message]
2018-11-09 20:19 ` [dpdk-dev] [PATCH 0/6] net/cxgbe: bug fixes Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f3b01eeb9ee265377cf969db937b0037d09bbcd0.1541747960.git.rahul.lakkireddy@chelsio.com \
    --to=rahul.lakkireddy@chelsio.com \
    --cc=dev@dpdk.org \
    --cc=indranil@chelsio.com \
    --cc=nirranjan@chelsio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).