Verify that channel info is available in hostapd_hw_get_channel()
Unexpected CHAN_SWITCH command could get this function using a NULL pointer if the channel switch was requested while the interface was already disabled. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
b9058266f0
commit
eb314e8af2
1 changed files with 8 additions and 3 deletions
|
@ -936,11 +936,16 @@ int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq)
|
|||
int i, channel;
|
||||
struct hostapd_hw_modes *mode;
|
||||
|
||||
channel = hw_get_chan(hapd->iface->current_mode, freq);
|
||||
if (channel)
|
||||
return channel;
|
||||
if (hapd->iface->current_mode) {
|
||||
channel = hw_get_chan(hapd->iface->current_mode, freq);
|
||||
if (channel)
|
||||
return channel;
|
||||
}
|
||||
|
||||
/* Check other available modes since the channel list for the current
|
||||
* mode did not include the specified frequency. */
|
||||
if (!hapd->iface->hw_features)
|
||||
return 0;
|
||||
for (i = 0; i < hapd->iface->num_hw_features; i++) {
|
||||
mode = &hapd->iface->hw_features[i];
|
||||
channel = hw_get_chan(mode, freq);
|
||||
|
|
Loading…
Reference in a new issue