netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH Linux-2.6.8-rc2] prism54 Fix memory leaks
@ 2004-08-06 11:24 Margit Schubert-While
  2004-08-10 20:53 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Margit Schubert-While @ 2004-08-06 11:24 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev, prism54-devel

[-- Attachment #1: Type: text/plain, Size: 690 bytes --]

2004-08-06 Margit Schubert-While <margitsw@t-online.de>
* Change the "version" OID to what it should be.
*
* Fix memory leaks - mgt_get_request always returns
* allocated memory for non-int OIDS (with an exception -
* keep reading). If the caller checks the return and itself
* returns, then it must free memory.
* However, it is possible to return from mgt_get_request
* early (!priv->mib). In this case, weird things can happen
* in isl_ioctl. Quick fix, at least to force an oops, is
* to set the union value to NULL. The real fix is to
* recode all mgt_get_request calls in isl_ioctl.

 Jeff, have had no response to patch "Fix IRQ handling"
 from 2004-07-30.

Margit

Margit











[-- Attachment #2: memleak.patch --]
[-- Type: text/x-diff, Size: 2002 bytes --]

diff -Naur linux-2.6.8-01/drivers/net/wireless/prism54/isl_ioctl.c linux-2.6.8-04/drivers/net/wireless/prism54/isl_ioctl.c
--- linux-2.6.8-01/drivers/net/wireless/prism54/isl_ioctl.c	2004-07-27 19:42:33.000000000 +0200
+++ linux-2.6.8-04/drivers/net/wireless/prism54/isl_ioctl.c	2004-08-06 11:42:40.000000000 +0200
@@ -820,9 +820,11 @@
 		return mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile);
 	}
 
-	if ((ret =
-	     mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r)))
+	ret = mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r);
+	if (ret) {
+		kfree(r.ptr);
 		return ret;
+	}
 
 	rate = (u32) (vwrq->value / 500000);
 	data = r.ptr;
@@ -840,6 +842,7 @@
 	}
 
 	if (!data[i]) {
+		kfree(r.ptr);
 		return -EINVAL;
 	}
 
@@ -888,8 +891,11 @@
 	vwrq->value = r.u * 500000;
 
 	/* request the device for the enabled rates */
-	if ((rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r)))
+	rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r);
+	if (rvalue) {
+		kfree(r.ptr);
 		return rvalue;
+	}
 	data = r.ptr;
 	vwrq->fixed = (data[0] != 0) && (data[1] == 0);
 	kfree(r.ptr);
diff -Naur linux-2.6.8-01/drivers/net/wireless/prism54/oid_mgt.c linux-2.6.8-04/drivers/net/wireless/prism54/oid_mgt.c
--- linux-2.6.8-01/drivers/net/wireless/prism54/oid_mgt.c	2004-07-27 19:42:33.000000000 +0200
+++ linux-2.6.8-04/drivers/net/wireless/prism54/oid_mgt.c	2004-08-06 11:42:50.000000000 +0200
@@ -219,7 +219,7 @@
 	OID_UNKNOWN(OID_INL_MEMORY, 0xFF020002),
 	OID_U32_C(OID_INL_MODE, 0xFF020003),
 	OID_UNKNOWN(OID_INL_COMPONENT_NR, 0xFF020004),
-	OID_UNKNOWN(OID_INL_VERSION, 0xFF020005),
+	OID_STRUCT(OID_INL_VERSION, 0xFF020005, u8[8], OID_TYPE_RAW),
 	OID_UNKNOWN(OID_INL_INTERFACE_ID, 0xFF020006),
 	OID_UNKNOWN(OID_INL_COMPONENT_ID, 0xFF020007),
 	OID_U32_C(OID_INL_CONFIG, 0xFF020008),
@@ -481,6 +481,8 @@
 	BUG_ON(OID_NUM_LAST <= n);
 	BUG_ON(extra > isl_oid[n].range);
 
+	res->ptr = NULL;
+
 	if (!priv->mib)
 		/* memory has been freed */
 		return -1;

[-- Attachment #3: Type: text/plain, Size: 151 bytes --]

_______________________________________________
Prism54-devel mailing list
Prism54-devel@prism54.org
http://prism54.org/mailman/listinfo/prism54-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH Linux-2.6.8-rc2] prism54 Fix memory leaks
  2004-08-06 11:24 [PATCH Linux-2.6.8-rc2] prism54 Fix memory leaks Margit Schubert-While
@ 2004-08-10 20:53 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2004-08-10 20:53 UTC (permalink / raw)
  To: Margit Schubert-While; +Cc: netdev, prism54-devel

applied

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-08-10 20:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-06 11:24 [PATCH Linux-2.6.8-rc2] prism54 Fix memory leaks Margit Schubert-While
2004-08-10 20:53 ` Jeff Garzik

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).