libertas: fix potential NULL-pointer dereference
authorSven Neumann <s.neumann@raumfeld.com>
Thu, 9 Dec 2010 08:38:36 +0000 (09:38 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 13 Dec 2010 19:53:46 +0000 (14:53 -0500)
The code wants to check if there's a channel and it is not disabled,
but it used to check if channel is not NULL and accessed the channel
struct if this check failed.

Signed-off-by: Sven Neumann <s.neumann@raumfeld.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/cfg.c

index 373930afc26b50f2d7cddeb9027b07f8e5ad7775..113f4f204657ec911b6fe01c112f83f57d0d7fa8 100644 (file)
@@ -619,7 +619,7 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy,
                                     print_ssid(ssid_buf, ssid, ssid_len),
                                     LBS_SCAN_RSSI_TO_MBM(rssi)/100);
 
-                       if (channel ||
+                       if (channel &&
                            !(channel->flags & IEEE80211_CHAN_DISABLED))
                                cfg80211_inform_bss(wiphy, channel,
                                        bssid, le64_to_cpu(*(__le64 *)tsfdesc),