broadcom-wl-6.30.223.271-debian-fix-kernel-warnings.patch 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. From debian
  2. ---
  3. src/wl/sys/wl_cfg80211_hybrid.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
  4. 1 file changed, 60 insertions(+), 27 deletions(-)
  5. diff -Nurp broadcom-wl-6.30.223.271.orig/src/wl/sys/wl_cfg80211_hybrid.c broadcom-wl-6.30.223.271/src/wl/sys/wl_cfg80211_hybrid.c
  6. --- broadcom-wl-6.30.223.271.orig/src/wl/sys/wl_cfg80211_hybrid.c 2020-01-11 01:53:58.508062673 +0200
  7. +++ broadcom-wl-6.30.223.271/src/wl/sys/wl_cfg80211_hybrid.c 2020-01-11 01:55:42.011784473 +0200
  8. @@ -1984,7 +1984,7 @@ static s32 wl_inform_single_bss(struct w
  9. if (dtoh32(bi->length) > WL_BSS_INFO_MAX) {
  10. WL_DBG(("Beacon is larger than buffer. Discarding\n"));
  11. - return err;
  12. + return -E2BIG;
  13. }
  14. notif_bss_info = kzalloc(sizeof(*notif_bss_info) + sizeof(*mgmt) - sizeof(u8) +
  15. WL_BSS_INFO_MAX, GFP_KERNEL);
  16. @@ -2008,9 +2008,15 @@ static s32 wl_inform_single_bss(struct w
  17. beacon_proberesp->capab_info = cpu_to_le16(bi->capability);
  18. wl_rst_ie(wl);
  19. - wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length);
  20. - wl_cp_ie(wl, beacon_proberesp->variable, WL_BSS_INFO_MAX -
  21. + err = wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length);
  22. + if (err)
  23. + goto inform_single_bss_out;
  24. +
  25. + err = wl_cp_ie(wl, beacon_proberesp->variable, WL_BSS_INFO_MAX -
  26. offsetof(struct wl_cfg80211_bss_info, frame_buf));
  27. + if (err)
  28. + goto inform_single_bss_out;
  29. +
  30. notif_bss_info->frame_len = offsetof(struct ieee80211_mgmt, u.beacon.variable) +
  31. wl_get_ielen(wl);
  32. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
  33. @@ -2022,14 +2028,14 @@ static s32 wl_inform_single_bss(struct w
  34. #endif
  35. if (freq == 0) {
  36. WL_ERR(("Invalid channel, fail to chcnage channel to freq\n"));
  37. - kfree(notif_bss_info);
  38. - return -EINVAL;
  39. + err = -EINVAL;
  40. + goto inform_single_bss_out;
  41. }
  42. channel = ieee80211_get_channel(wiphy, freq);
  43. if (unlikely(!channel)) {
  44. WL_ERR(("ieee80211_get_channel error\n"));
  45. - kfree(notif_bss_info);
  46. - return -EINVAL;
  47. + err = -EINVAL;
  48. + goto inform_single_bss_out;
  49. }
  50. WL_DBG(("SSID : \"%s\", rssi %d, channel %d, capability : 0x04%x, bssid %pM\n",
  51. @@ -2037,28 +2043,37 @@ static s32 wl_inform_single_bss(struct w
  52. mgmt->u.beacon.capab_info, &bi->BSSID));
  53. signal = notif_bss_info->rssi * 100;
  54. - cbss = cfg80211_inform_bss_frame(wiphy, channel, mgmt,
  55. - le16_to_cpu(notif_bss_info->frame_len), signal, GFP_KERNEL);
  56. - if (unlikely(!cbss)) {
  57. - WL_ERR(("cfg80211_inform_bss_frame error\n"));
  58. - kfree(notif_bss_info);
  59. - return -EINVAL;
  60. - }
  61. - notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
  62. - notify_ielen = le32_to_cpu(bi->ie_length);
  63. + if (!wl->scan_request) {
  64. + cbss = cfg80211_inform_bss_frame(wiphy, channel, mgmt,
  65. + le16_to_cpu(notif_bss_info->frame_len), signal, GFP_KERNEL);
  66. + if (unlikely(!cbss)) {
  67. + WL_ERR(("cfg80211_inform_bss_frame error\n"));
  68. + err = -ENOMEM;
  69. + goto inform_single_bss_out;
  70. + }
  71. + } else {
  72. + notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
  73. + notify_ielen = le32_to_cpu(bi->ie_length);
  74. #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
  75. - cbss = cfg80211_inform_bss(wiphy, channel, (const u8 *)(bi->BSSID.octet),
  76. - 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int,
  77. - (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
  78. + cbss = cfg80211_inform_bss(wiphy, channel, (const u8 *)(bi->BSSID.octet),
  79. + 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int,
  80. + (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
  81. #else
  82. - cbss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, (const u8 *)(bi->BSSID.octet),
  83. - 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int,
  84. - (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
  85. + cbss = cfg80211_inform_bss(wiphy, channel,
  86. + wl->active_scan ?
  87. + CFG80211_BSS_FTYPE_PRESP : CFG80211_BSS_FTYPE_BEACON,
  88. + (const u8 *)(bi->BSSID.octet), 0,
  89. + beacon_proberesp->capab_info,
  90. + beacon_proberesp->beacon_int,
  91. + (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
  92. #endif
  93. -
  94. - if (unlikely(!cbss))
  95. - return -ENOMEM;
  96. + if (unlikely(!cbss)) {
  97. + WL_ERR(("cfg80211_inform_bss error\n"));
  98. + err = -ENOMEM;
  99. + goto inform_single_bss_out;
  100. + }
  101. + }
  102. #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
  103. cfg80211_put_bss(wiphy, cbss);
  104. @@ -2066,6 +2081,7 @@ static s32 wl_inform_single_bss(struct w
  105. cfg80211_put_bss(cbss);
  106. #endif
  107. +inform_single_bss_out:
  108. kfree(notif_bss_info);
  109. return err;
  110. @@ -2332,6 +2348,9 @@ static s32 wl_update_bss_info(struct wl_
  111. if (err)
  112. goto update_bss_info_out;
  113. + bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
  114. + ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
  115. +
  116. ie = ((u8 *)bi) + bi->ie_offset;
  117. ie_len = bi->ie_length;
  118. } else {
  119. @@ -2344,11 +2363,18 @@ static s32 wl_update_bss_info(struct wl_
  120. ie_len = bss->len_information_elements;
  121. #endif
  122. wl->conf->channel = *bss->channel;
  123. + }
  124. +
  125. + if (bss) {
  126. #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
  127. cfg80211_put_bss(wiphy, bss);
  128. #else
  129. cfg80211_put_bss(bss);
  130. #endif
  131. + } else {
  132. + WL_DBG(("Could not update BSS\n"));
  133. + err = -EINVAL;
  134. + goto update_bss_info_out;
  135. }
  136. tim = bcm_parse_tlvs(ie, ie_len, WLAN_EID_TIM);
  137. @@ -2390,10 +2416,17 @@ wl_bss_roaming_done(struct wl_cfg80211_p
  138. #endif
  139. s32 err = 0;
  140. - wl_get_assoc_ies(wl);
  141. + err = wl_get_assoc_ies(wl);
  142. + if (err)
  143. + return err;
  144. +
  145. memcpy(wl->profile->bssid, &e->addr, ETHER_ADDR_LEN);
  146. memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
  147. - wl_update_bss_info(wl);
  148. +
  149. + err = wl_update_bss_info(wl);
  150. + if (err)
  151. + return err;
  152. +
  153. cfg80211_roamed(ndev,
  154. #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
  155. &roam_info,