[PATCH] Weird stack trace for HostAP in 2.6.14-rc2
Jean Tourrilhes
jt
Tue Sep 20 15:59:25 PDT 2005
Hi,
2 patches for HostAP in the kernel...
This is the trace I got :
----------------------------------------------------
[ 224.918985] Debug: sleeping function called from invalid context at mm/slab.c:2459
[ 224.919046] in_atomic():1, irqs_disabled():0
[ 224.919090] [<c01198a7>] __might_sleep+0xa7/0xb0
[ 224.919159] [<d08b815d>] hfa384x_setup_bap+0xcd/0x150 [hostap_cs]
[ 224.919238] [<c0146cfc>] kmem_cache_alloc+0x7c/0x80
[ 224.919298] [<d092c4c6>] __prism2_translate_scan+0x386/0x6f0 [hostap]
[ 224.919408] [<d092c9ab>] prism2_ioctl_giwscan+0x17b/0x320 [hostap]
[ 224.919483] [<c0242132>] wireless_process_ioctl+0x222/0x7a0
[ 224.919543] [<d092c830>] prism2_ioctl_giwscan+0x0/0x320 [hostap]
[ 224.919615] [<c0236b1f>] dev_ioctl+0x1ff/0x300
[ 224.919671] [<c022b7d7>] sock_ioctl+0x267/0x280
[ 224.919725] [<c017100e>] do_ioctl+0x8e/0xa0
[ 224.919788] [<c01711f5>] vfs_ioctl+0x65/0x1f0
[ 224.919837] [<c01713c5>] sys_ioctl+0x45/0x70
[ 224.919887] [<c0103019>] syscall_call+0x7/0xb
----------------------------------------------------
Weird thing is that I never got that with the driver compiled
externally.
I believe the fix is along those lines :
-------------------------------------
--- linux/drivers/net/wireless/hostap/hostap_ioctl.j1.c 2005-09-20 15:49:14.000000000 -0700
+++ linux/drivers/net/wireless/hostap/hostap_ioctl.c 2005-09-20 15:49:33.000000000 -0700
@@ -1930,7 +1930,7 @@ static char * __prism2_translate_scan(lo
}
/* TODO: add BeaconInt,resp_rate,atim into BSS table */
- buf = kmalloc(MAX_WPA_IE_LEN * 2 + 30, GFP_KERNEL);
+ buf = kmalloc(MAX_WPA_IE_LEN * 2 + 30, GFP_ATOMIC);
if (buf && scan) {
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVCUSTOM;
-------------------------------------
Also, now that we are compiling with -fno-strict-aliasing
(this is the kernel default), we can drop the following kludge :
------------------------------------------
--- linux/drivers/net/wireless/hostap/hostap_ioctl.j2.c 2005-09-20 15:53:52.000000000 -0700
+++ linux/drivers/net/wireless/hostap/hostap_ioctl.c 2005-09-20 15:54:58.000000000 -0700
@@ -1827,13 +1827,6 @@ static char * __prism2_translate_scan(lo
iwe.cmd = SIOCGIWAP;
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
memcpy(iwe.u.ap_addr.sa_data, bssid, ETH_ALEN);
- /* FIX:
- * I do not know how this is possible, but iwe_stream_add_event
- * seems to re-order memcpy execution so that len is set only
- * after copying.. Pre-setting len here "fixes" this, but real
- * problems should be solved (after which these iwe.len
- * settings could be removed from this function). */
- iwe.len = IW_EV_ADDR_LEN;
current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
IW_EV_ADDR_LEN);
@@ -1843,7 +1836,6 @@ static char * __prism2_translate_scan(lo
iwe.cmd = SIOCGIWESSID;
iwe.u.data.length = ssid_len;
iwe.u.data.flags = 1;
- iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ssid);
memset(&iwe, 0, sizeof(iwe));
@@ -1859,7 +1851,6 @@ static char * __prism2_translate_scan(lo
iwe.u.mode = IW_MODE_MASTER;
else
iwe.u.mode = IW_MODE_ADHOC;
- iwe.len = IW_EV_UINT_LEN;
current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
IW_EV_UINT_LEN);
}
@@ -1877,7 +1868,6 @@ static char * __prism2_translate_scan(lo
if (chan > 0) {
iwe.u.freq.m = freq_list[le16_to_cpu(chan - 1)] * 100000;
iwe.u.freq.e = 1;
- iwe.len = IW_EV_FREQ_LEN;
current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
IW_EV_FREQ_LEN);
}
@@ -1894,7 +1884,6 @@ static char * __prism2_translate_scan(lo
iwe.u.qual.noise =
HFA384X_LEVEL_TO_dBm(le16_to_cpu(scan->anl));
}
- iwe.len = IW_EV_QUAL_LEN;
current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
IW_EV_QUAL_LEN);
}
@@ -1906,7 +1895,6 @@ static char * __prism2_translate_scan(lo
else
iwe.u.data.flags = IW_ENCODE_DISABLED;
iwe.u.data.length = 0;
- iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, "");
/* TODO: add SuppRates into BSS table */
------------------------------------------
Both tested quickly on 2.6.14-rc2.
Have fun...
Jean
More information about the Hostap
mailing list