Subject: Re: latest ath/net80211 from freebsd
To: None <tech-net@netbsd.org>
From: Steve Woodford <scw@netbsd.org>
List: tech-net
Date: 06/07/2005 19:03:05
--Boundary-00=_ZFepCc6NdulCoPs
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Tuesday 07 June 2005 18:55, David Young wrote:

> I overlooked some crypto dependencies.  In sys/conf/files, add
> ", rijndael" to the directive "file ieee80211_crypto_ccmp.c wlan".

One more change is required, to kern_sysctl.c. Without the attached 
patch, an i386 kernel crashes while attaching my cardbus ath(4) (kernel 
stack overflow). I'm waiting for feedback from Andrew Brown before 
committing this fix.

Even with the patch, my ath(4) card is mute. It associates with my AP, 
but no data flows.

Cheers, Steve

--Boundary-00=_ZFepCc6NdulCoPs
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="kern_sysctl.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="kern_sysctl.c.diff"

Index: kern_sysctl.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_sysctl.c,v
retrieving revision 1.180
diff -u -r1.180 kern_sysctl.c
--- kern_sysctl.c	29 May 2005 22:24:15 -0000	1.180
+++ kern_sysctl.c	7 Jun 2005 16:06:23 -0000
@@ -920,27 +920,35 @@
 				return (EINVAL);
 			}
 			else {
-				char vp[PAGE_SIZE], *e;
+				char *vp, *e;
 				size_t s;
 
 				/*
 				 * we want a rough idea of what the
 				 * size is now
 				 */
+				vp = malloc(PAGE_SIZE, M_SYSCTLDATA,
+					     M_WAITOK|M_CANFAIL);
+				if (vp == NULL)
+					return (ENOMEM);
 				e = nnode.sysctl_data;
 				do {
-					error = copyinstr(e, &vp[0], sizeof(vp),
-							  &s);
+					error = copyinstr(e, vp, PAGE_SIZE, &s);
 					if (error) {
-						if (error != ENAMETOOLONG)
+						if (error != ENAMETOOLONG) {
+							free(vp, M_SYSCTLDATA);
 							return (error);
+						}
 						e += PAGE_SIZE;
 						if ((e - 32 * PAGE_SIZE) >
-						    (char*)nnode.sysctl_data)
+						    (char*)nnode.sysctl_data) {
+							free(vp, M_SYSCTLDATA);
 							return (ERANGE);
+						}
 					}
 				} while (error != 0);
 				sz = s + (e - (char*)nnode.sysctl_data);
+				free(vp, M_SYSCTLDATA);
 			}
 		}
 		break;

--Boundary-00=_ZFepCc6NdulCoPs--