hostap 0.4.7 - iwlist scan kernel panic on ppc when in managed mode

Pavel Roskin proski
Wed Apr 12 00:16:24 PDT 2006


Hello!

On Tue, 2006-04-11 at 12:51 +0300, Stelios Koroneos wrote:
> Just noticed that in my conf i posted the 0.4.4 drivers are loaded instead
> of the 0.4.7 i mention.
> This is due to the fact that i tried both 0.4.4 and 0.4.7 and the problem
> exists in both.
[skip]
> Also noted that other ppc users are having the same problem
> http://lists.shmoo.com/pipermail/hostap/2006-April/013001.html

Stelios, I appreciate your research that indicated that the problem is
not unique to your setup and relevant to the current code.  Otherwise I
wouldn't dig out my old dusty Mac :-)

It is indeed an endianess problem in the driver, and it exists both in
CVS and in the current kernel.

Basically, having an AP in the range using channel other than 1 will
cause kernel panic.  The problem is caused by performing arithmetic on a
little-endian value of the channel.

Please test this patch:

--- driver/modules/hostap_ioctl.c
+++ driver/modules/hostap_ioctl.c
@@ -1840,7 +1840,7 @@ static char * __prism2_translate_scan(lo
 	memset(&iwe, 0, sizeof(iwe));
 	iwe.cmd = SIOCGIWFREQ;
 	if (scan) {
-		chan = scan->chid;
+		chan = le16_to_cpu(scan->chid);
 	} else if (bss) {
 		chan = bss->chan;
 	} else {
@@ -1848,7 +1848,7 @@ static char * __prism2_translate_scan(lo
 	}
 
 	if (chan > 0) {
-		iwe.u.freq.m = freq_list[le16_to_cpu(chan - 1)] * 100000;
+		iwe.u.freq.m = freq_list[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,

This would have been found by sparse if hostap was properly
sparse-annotated.  I think it's about time to do it.

-- 
Regards,
Pavel Roskin





More information about the Hostap mailing list