Commit a2e2322d authored by Wey-Yi Guy's avatar Wey-Yi Guy Committed by John W. Linville

iwlwifi: check for valid band for channel info

when display channel info in debugfs, always check for valid band
before access the pointer and display information

for 1000 NIC, it only support "bgn" mode, so there is no 5.2GHz channels
available to display.
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 086ed117
...@@ -380,6 +380,7 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf, ...@@ -380,6 +380,7 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
} }
supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ);
if (supp_band) {
channels = supp_band->channels; channels = supp_band->channels;
pos += scnprintf(buf + pos, bufsz - pos, pos += scnprintf(buf + pos, bufsz - pos,
...@@ -401,8 +402,9 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf, ...@@ -401,8 +402,9 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
channels[i].flags & channels[i].flags &
IEEE80211_CHAN_PASSIVE_SCAN ? IEEE80211_CHAN_PASSIVE_SCAN ?
"passive only" : "active/passive"); "passive only" : "active/passive");
}
supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ); supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ);
if (supp_band) {
channels = supp_band->channels; channels = supp_band->channels;
pos += scnprintf(buf + pos, bufsz - pos, pos += scnprintf(buf + pos, bufsz - pos,
...@@ -424,6 +426,7 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf, ...@@ -424,6 +426,7 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
channels[i].flags & channels[i].flags &
IEEE80211_CHAN_PASSIVE_SCAN ? IEEE80211_CHAN_PASSIVE_SCAN ?
"passive only" : "active/passive"); "passive only" : "active/passive");
}
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
kfree(buf); kfree(buf);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment