17-fix-kernel-warnings.patch 4.9 KB

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