瀏覽代碼

[PATCH] Fix crash on big-endian systems during scan

The original code was doing arithmetics on a little-endian value.
Reported by Stelios Koroneos <stelios@stelioscellar.com>

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Pavel Roskin 19 年之前
父節點
當前提交
dac322e39a
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      drivers/net/wireless/hostap/hostap_ioctl.c

+ 2 - 2
drivers/net/wireless/hostap/hostap_ioctl.c

@@ -1860,7 +1860,7 @@ static char * __prism2_translate_scan(local_info_t *local,
 	memset(&iwe, 0, sizeof(iwe));
 	memset(&iwe, 0, sizeof(iwe));
 	iwe.cmd = SIOCGIWFREQ;
 	iwe.cmd = SIOCGIWFREQ;
 	if (scan) {
 	if (scan) {
-		chan = scan->chid;
+		chan = le16_to_cpu(scan->chid);
 	} else if (bss) {
 	} else if (bss) {
 		chan = bss->chan;
 		chan = bss->chan;
 	} else {
 	} else {
@@ -1868,7 +1868,7 @@ static char * __prism2_translate_scan(local_info_t *local,
 	}
 	}
 
 
 	if (chan > 0) {
 	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.u.freq.e = 1;
 		current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
 		current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
 						  IW_EV_FREQ_LEN);
 						  IW_EV_FREQ_LEN);