From: Sven Neumann Date: Thu, 9 Dec 2010 08:38:36 +0000 (+0100) Subject: libertas: fix potential NULL-pointer dereference X-Git-Tag: v3.12-rc1~7905^2~7^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a55d5852adbe66722fb1636c82c7864cd5be441;p=kernel%2Fkernel-generic.git libertas: fix potential NULL-pointer dereference 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 Acked-by: Dan Williams Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 373930a..113f4f2 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c @@ -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),