rndis_wlan: fix le16/le32_to_cpu mix up with config.beacon_period
'beacon_period' in 'struct ndis_80211_conf' is __le32 instead of __le16 so le32_to_cpu must be used instead of le16_to_cpu. Also correct 'beacon_interval' variables used for passing this value forward from u16 to u32 and rename those variables 'beacon_period' This is to avoid confusion because 'beacon_interval' is defined as __le16 at other structure, 'struct ndis_80211_fixed_ies'. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
e4e02da2ef
commit
f808e4ad05
@@ -1350,7 +1350,7 @@ static int set_channel(struct usbnet *usbdev, int channel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct ieee80211_channel *get_current_channel(struct usbnet *usbdev,
|
static struct ieee80211_channel *get_current_channel(struct usbnet *usbdev,
|
||||||
u16 *beacon_interval)
|
u32 *beacon_period)
|
||||||
{
|
{
|
||||||
struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
|
struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
|
||||||
struct ieee80211_channel *channel;
|
struct ieee80211_channel *channel;
|
||||||
@@ -1370,8 +1370,8 @@ static struct ieee80211_channel *get_current_channel(struct usbnet *usbdev,
|
|||||||
if (!channel)
|
if (!channel)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (beacon_interval)
|
if (beacon_period)
|
||||||
*beacon_interval = le16_to_cpu(config.beacon_period);
|
*beacon_period = le32_to_cpu(config.beacon_period);
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2683,7 +2683,7 @@ static void rndis_wlan_craft_connected_bss(struct usbnet *usbdev, u8 *bssid,
|
|||||||
s32 signal;
|
s32 signal;
|
||||||
u64 timestamp;
|
u64 timestamp;
|
||||||
u16 capability;
|
u16 capability;
|
||||||
u16 beacon_interval = 0;
|
u32 beacon_period = 0;
|
||||||
__le32 rssi;
|
__le32 rssi;
|
||||||
u8 ie_buf[34];
|
u8 ie_buf[34];
|
||||||
int len, ret, ie_len;
|
int len, ret, ie_len;
|
||||||
@@ -2708,7 +2708,7 @@ static void rndis_wlan_craft_connected_bss(struct usbnet *usbdev, u8 *bssid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get channel and beacon interval */
|
/* Get channel and beacon interval */
|
||||||
channel = get_current_channel(usbdev, &beacon_interval);
|
channel = get_current_channel(usbdev, &beacon_period);
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
netdev_warn(usbdev->net, "%s(): could not get channel.\n",
|
netdev_warn(usbdev->net, "%s(): could not get channel.\n",
|
||||||
__func__);
|
__func__);
|
||||||
@@ -2738,11 +2738,11 @@ static void rndis_wlan_craft_connected_bss(struct usbnet *usbdev, u8 *bssid,
|
|||||||
netdev_dbg(usbdev->net, "%s(): channel:%d(freq), bssid:[%pM], tsf:%d, "
|
netdev_dbg(usbdev->net, "%s(): channel:%d(freq), bssid:[%pM], tsf:%d, "
|
||||||
"capa:%x, beacon int:%d, resp_ie(len:%d, essid:'%.32s'), "
|
"capa:%x, beacon int:%d, resp_ie(len:%d, essid:'%.32s'), "
|
||||||
"signal:%d\n", __func__, (channel ? channel->center_freq : -1),
|
"signal:%d\n", __func__, (channel ? channel->center_freq : -1),
|
||||||
bssid, (u32)timestamp, capability, beacon_interval, ie_len,
|
bssid, (u32)timestamp, capability, beacon_period, ie_len,
|
||||||
ssid.essid, signal);
|
ssid.essid, signal);
|
||||||
|
|
||||||
bss = cfg80211_inform_bss(priv->wdev.wiphy, channel, bssid,
|
bss = cfg80211_inform_bss(priv->wdev.wiphy, channel, bssid,
|
||||||
timestamp, capability, beacon_interval, ie_buf, ie_len,
|
timestamp, capability, beacon_period, ie_buf, ie_len,
|
||||||
signal, GFP_KERNEL);
|
signal, GFP_KERNEL);
|
||||||
cfg80211_put_bss(bss);
|
cfg80211_put_bss(bss);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user