[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    rtl8180: avoid NULL dereference in max2820_rf_set_channel
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2008-05-30 14:59:14
Message-ID: 200805301459.m4UExENv025919 () hera ! kernel ! org
[Download RAW message or body]

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6f6c218f68e632e4596cae6e6d43658d26a5e0fe
Commit:     6f6c218f68e632e4596cae6e6d43658d26a5e0fe
Parent:     289c79a4bd350e8a25065102563ad1a183d1b402
Author:     John W. Linville <linville@tuxdriver.com>
AuthorDate: Tue May 27 17:01:55 2008 -0400
Committer:  John W. Linville <linville@tuxdriver.com>
CommitDate: Wed May 28 16:43:38 2008 -0400

    rtl8180: avoid NULL dereference in max2820_rf_set_channel
    
    The static function max2820_rf_set_channel is called with conf == NULL
    within its compilation unit.  Originally this defaulted to b/g channel
    1, but "cfg80211 API for channels/bitrates, mac80211 and driver
    conversion" (commit 8318d78a44d49ac1edf2bdec7299de3617c4232e) mistakenly
    dropped this check.  This patch minimally restores the expected
    behavior.
    
    Reported-by: Colin Lai <colin_sh@163.com>
    Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 drivers/net/wireless/rtl8180_max2820.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/rtl8180_max2820.c b/drivers/net/wireless/rtl8180_max2820.c
index a34dfd3..a140c80 100644
--- a/drivers/net/wireless/rtl8180_max2820.c
+++ b/drivers/net/wireless/rtl8180_max2820.c
@@ -78,7 +78,8 @@ static void max2820_rf_set_channel(struct ieee80211_hw *dev,
 				   struct ieee80211_conf *conf)
 {
 	struct rtl8180_priv *priv = dev->priv;
-	int channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
+	int channel = conf ?
+		ieee80211_frequency_to_channel(conf->channel->center_freq) : 1;
 	unsigned int chan_idx = channel - 1;
 	u32 txpw = priv->channels[chan_idx].hw_value & 0xFF;
 	u32 chan = max2820_chan[chan_idx];
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic