All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PS3: gelic: ignore scan info from zero SSID beacons
@ 2008-03-11  4:15 Masakazu Mokuno
  2008-03-11 16:18 ` Johannes Berg
  0 siblings, 1 reply; 12+ messages in thread
From: Masakazu Mokuno @ 2008-03-11  4:15 UTC (permalink / raw)
  To: John W. Linville
  Cc: linux-wireless, cbe-oss-dev, Geert Uytterhoeven, Stefan Assmann

Some implementations of the hidden SSID APs emit beacons which have the zero
length SSID information element instead of SSID padded by null (\0) characters.
If the firmware of the PS3 wireless hardware meets these beacons, it abandons parsing
IEs. Thus guest OSes get the invalid scan information for the AP.

To work around this, ignore these scan informations from the list.

Signed-off-by: Masakazu Mokuno <mokuno@sm.sony.co.jp>
---

This patch was submitted for 2.6.24.3 by Geert on Mar 10.  But I have not
submitted for 2.6.25 yet.  Please apply for 2.6.25.


 drivers/net/ps3_gelic_wireless.c |   27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

--- a/drivers/net/ps3_gelic_wireless.c
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -1644,13 +1644,24 @@ static void gelic_wl_scan_complete_event
 	}
 
 	/* put them in the newtork_list */
-	scan_info = wl->buf;
-	scan_info_size = 0;
-	i = 0;
-	while (scan_info_size < data_len) {
+	for (i = 0, scan_info_size = 0, scan_info = wl->buf;
+	     scan_info_size < data_len;
+	     i++, scan_info_size += be16_to_cpu(scan_info->size),
+	     scan_info = (void *)scan_info + be16_to_cpu(scan_info->size)) {
 		pr_debug("%s:size=%d bssid=%s scan_info=%p\n", __func__,
 			 be16_to_cpu(scan_info->size),
 			 print_mac(mac, &scan_info->bssid[2]), scan_info);
+
+		/*
+		 * The wireless firmware may return invalid channel 0 and/or
+		 * invalid rate if the AP emits zero length SSID ie. As this
+		 * scan information is useless, ignore it
+		 */
+		if (!be16_to_cpu(scan_info->channel) || !scan_info->rate[0]) {
+			pr_debug("%s: invalid scan info\n", __func__);
+			continue;
+		}
+
 		found = 0;
 		oldest = NULL;
 		list_for_each_entry(target, &wl->network_list, list) {
@@ -1687,10 +1698,6 @@ static void gelic_wl_scan_complete_event
 					 GFP_KERNEL);
 		if (!target->hwinfo) {
 			pr_info("%s: kzalloc failed\n", __func__);
-			i++;
-			scan_info_size += be16_to_cpu(scan_info->size);
-			scan_info = (void *)scan_info +
-				be16_to_cpu(scan_info->size);
 			continue;
 		}
 		/* copy hw scan info */
@@ -1709,10 +1716,6 @@ static void gelic_wl_scan_complete_event
 			if (scan_info->ext_rate[r])
 				target->rate_ext_len++;
 		list_move_tail(&target->list, &wl->network_list);
-		/* bump pointer */
-		i++;
-		scan_info_size += be16_to_cpu(scan_info->size);
-		scan_info = (void *)scan_info + be16_to_cpu(scan_info->size);
 	}
 	memset(&data, 0, sizeof(data));
 	wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWSCAN, &data,

-- 
Masakazu MOKUNO


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

end of thread, other threads:[~2008-03-13  7:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-11  4:15 [PATCH] PS3: gelic: ignore scan info from zero SSID beacons Masakazu Mokuno
2008-03-11 16:18 ` Johannes Berg
2008-03-11 16:50   ` Dan Williams
2008-03-11 17:10     ` John W. Linville
2008-03-12  2:18       ` Masakazu Mokuno
2008-03-12  8:25         ` Johannes Berg
2008-03-12 10:26           ` Masakazu Mokuno
2008-03-12 13:42             ` Dan Williams
2008-03-12 14:31               ` Johannes Berg
2008-03-12 14:43                 ` Johannes Berg
2008-03-13  7:01                   ` Masakazu Mokuno
2008-03-12  2:24   ` Masakazu Mokuno

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.