summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2008-05-27 17:01:55 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-28 16:43:38 -0400
commit6f6c218f68e632e4596cae6e6d43658d26a5e0fe (patch)
tree8586bdd871c382f673005a669a1c48f23c595782
parent289c79a4bd350e8a25065102563ad1a183d1b402 (diff)
downloadlinux-stable-6f6c218f68e632e4596cae6e6d43658d26a5e0fe.tar.gz
linux-stable-6f6c218f68e632e4596cae6e6d43658d26a5e0fe.tar.bz2
linux-stable-6f6c218f68e632e4596cae6e6d43658d26a5e0fe.zip
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>
-rw-r--r--drivers/net/wireless/rtl8180_max2820.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/wireless/rtl8180_max2820.c b/drivers/net/wireless/rtl8180_max2820.c
index a34dfd382b6d..a140c802264a 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];