diff options
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 807d448e702e..93bc63eae076 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -4997,6 +4997,7 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, | |||
4997 | const struct cfg80211_bss_ies *ies; | 4997 | const struct cfg80211_bss_ies *ies; |
4998 | void *hdr; | 4998 | void *hdr; |
4999 | struct nlattr *bss; | 4999 | struct nlattr *bss; |
5000 | bool tsf = false; | ||
5000 | 5001 | ||
5001 | ASSERT_WDEV_LOCK(wdev); | 5002 | ASSERT_WDEV_LOCK(wdev); |
5002 | 5003 | ||
@@ -5020,22 +5021,24 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, | |||
5020 | 5021 | ||
5021 | rcu_read_lock(); | 5022 | rcu_read_lock(); |
5022 | ies = rcu_dereference(res->ies); | 5023 | ies = rcu_dereference(res->ies); |
5023 | if (ies && ies->len && nla_put(msg, NL80211_BSS_INFORMATION_ELEMENTS, | 5024 | if (ies) { |
5024 | ies->len, ies->data)) { | 5025 | if (nla_put_u64(msg, NL80211_BSS_TSF, ies->tsf)) |
5025 | rcu_read_unlock(); | 5026 | goto fail_unlock_rcu; |
5026 | goto nla_put_failure; | 5027 | tsf = true; |
5028 | if (ies->len && nla_put(msg, NL80211_BSS_INFORMATION_ELEMENTS, | ||
5029 | ies->len, ies->data)) | ||
5030 | goto fail_unlock_rcu; | ||
5027 | } | 5031 | } |
5028 | ies = rcu_dereference(res->beacon_ies); | 5032 | ies = rcu_dereference(res->beacon_ies); |
5029 | if (ies && ies->len && nla_put(msg, NL80211_BSS_BEACON_IES, | 5033 | if (ies) { |
5030 | ies->len, ies->data)) { | 5034 | if (!tsf && nla_put_u64(msg, NL80211_BSS_TSF, ies->tsf)) |
5031 | rcu_read_unlock(); | 5035 | goto fail_unlock_rcu; |
5032 | goto nla_put_failure; | 5036 | if (ies->len && nla_put(msg, NL80211_BSS_BEACON_IES, |
5037 | ies->len, ies->data)) | ||
5038 | goto fail_unlock_rcu; | ||
5033 | } | 5039 | } |
5034 | rcu_read_unlock(); | 5040 | rcu_read_unlock(); |
5035 | 5041 | ||
5036 | if (res->tsf && | ||
5037 | nla_put_u64(msg, NL80211_BSS_TSF, res->tsf)) | ||
5038 | goto nla_put_failure; | ||
5039 | if (res->beacon_interval && | 5042 | if (res->beacon_interval && |
5040 | nla_put_u16(msg, NL80211_BSS_BEACON_INTERVAL, res->beacon_interval)) | 5043 | nla_put_u16(msg, NL80211_BSS_BEACON_INTERVAL, res->beacon_interval)) |
5041 | goto nla_put_failure; | 5044 | goto nla_put_failure; |
@@ -5080,6 +5083,8 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, | |||
5080 | 5083 | ||
5081 | return genlmsg_end(msg, hdr); | 5084 | return genlmsg_end(msg, hdr); |
5082 | 5085 | ||
5086 | fail_unlock_rcu: | ||
5087 | rcu_read_unlock(); | ||
5083 | nla_put_failure: | 5088 | nla_put_failure: |
5084 | genlmsg_cancel(msg, hdr); | 5089 | genlmsg_cancel(msg, hdr); |
5085 | return -EMSGSIZE; | 5090 | return -EMSGSIZE; |