lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 13 Oct 2010 17:06:48 -0700
From:	"Michael Chan" <mchan@...adcom.com>
To:	davem@...emloft.net
cc:	netdev@...r.kernel.org
Subject: [PATCH 5/8 net-next] cnic: Add cnic_free_uio()

to free all UIO related structures.

Signed-off-by: Michael Chan <mchan@...adcom.com>
---
 drivers/net/cnic.c |   37 +++++++++++++++++++++++++++----------
 1 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index b12bba7..739ffcb 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -770,20 +770,15 @@ static void cnic_free_context(struct cnic_dev *dev)
 	}
 }
 
-static void cnic_free_resc(struct cnic_dev *dev)
+static void __cnic_free_uio(struct cnic_dev *dev)
 {
 	struct cnic_local *cp = dev->cnic_priv;
-	int i = 0;
 
-	if (cp->cnic_uinfo) {
-		while (cp->uio_dev != -1 && i < 15) {
-			msleep(100);
-			i++;
-		}
+	if (cp->cnic_uinfo)
 		uio_unregister_device(cp->cnic_uinfo);
-		kfree(cp->cnic_uinfo);
-		cp->cnic_uinfo = NULL;
-	}
+
+	kfree(cp->cnic_uinfo);
+	cp->cnic_uinfo = NULL;
 
 	if (cp->l2_buf) {
 		dma_free_coherent(&dev->pcidev->dev, cp->l2_buf_size,
@@ -796,6 +791,28 @@ static void cnic_free_resc(struct cnic_dev *dev)
 				  cp->l2_ring, cp->l2_ring_map);
 		cp->l2_ring = NULL;
 	}
+}
+
+static void cnic_free_uio(struct cnic_dev *dev)
+{
+	if (!dev)
+		return;
+
+	__cnic_free_uio(dev);
+}
+
+static void cnic_free_resc(struct cnic_dev *dev)
+{
+	struct cnic_local *cp = dev->cnic_priv;
+	int i = 0;
+
+	if (cp->cnic_uinfo) {
+		while (cp->uio_dev != -1 && i < 15) {
+			msleep(100);
+			i++;
+		}
+		cnic_free_uio(dev);
+	}
 
 	cnic_free_context(dev);
 	kfree(cp->ctx_arr);
-- 
1.6.4.GIT


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists