提交 6f6c218f 编写于 作者: J John W. Linville

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 8318d78a) mistakenly
dropped this check.  This patch minimally restores the expected
behavior.
Reported-by: NColin Lai <colin_sh@163.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 289c79a4
......@@ -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];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册