acx-mac80211: fix scan API error that could lead to a crash
[librecmc/librecmc.git] / package / kernel / acx-mac80211 / patches / 300-api_sync.patch
1 --- a/main.c
2 +++ b/main.c
3 @@ -497,7 +497,7 @@ int acx_free_mechanics(acx_device_t *ade
4  
5  int acx_init_ieee80211(acx_device_t *adev, struct ieee80211_hw *hw)
6  {
7 -       hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
8 +       __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, hw->flags);
9         hw->queues = 1;
10         hw->wiphy->max_scan_ssids = 1;
11  
12 @@ -525,14 +525,14 @@ int acx_init_ieee80211(acx_device_t *ade
13         /* We base signal quality on winlevel approach of previous driver
14          * TODO OW 20100615 This should into a common init code
15          */
16 -       hw->flags |= IEEE80211_HW_SIGNAL_UNSPEC;
17 +       __set_bit(IEEE80211_HW_SIGNAL_UNSPEC, hw->flags);
18         hw->max_signal = 100;
19  
20         if (IS_ACX100(adev)) {
21 -               adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
22 +               adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
23                         &acx100_band_2GHz;
24         } else if (IS_ACX111(adev))
25 -               adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
26 +               adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
27                         &acx111_band_2GHz;
28         else {
29                 log(L_ANY, "Error: Unknown device");
30 @@ -945,8 +945,8 @@ void acx_op_configure_filter(struct ieee
31                 changed_flags, *total_flags);
32  
33         /* OWI TODO: Set also FIF_PROBE_REQ ? */
34 -       *total_flags &= (FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL
35 -                       | FIF_CONTROL | FIF_OTHER_BSS);
36 +       *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_CONTROL
37 +                       | FIF_OTHER_BSS);
38  
39         logf1(L_DEBUG, "2: *total_flags=0x%08x\n", *total_flags);
40  
41 @@ -1045,9 +1045,10 @@ void acx_op_tx(struct ieee80211_hw *hw,
42  }
43  
44  int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
45 -                   struct cfg80211_scan_request *req)
46 +                   struct ieee80211_scan_request *hw_req)
47  {
48         acx_device_t *adev = hw2adev(hw);
49 +       struct cfg80211_scan_request *req = &hw_req->req;
50         struct sk_buff *skb;
51         size_t ssid_len = 0;
52         u8 *ssid = NULL;
53 @@ -1082,7 +1083,7 @@ int acx_op_hw_scan(struct ieee80211_hw *
54                 goto out;
55         }
56  #else
57 -       skb = ieee80211_probereq_get(adev->hw, adev->vif, ssid, ssid_len,
58 +       skb = ieee80211_probereq_get(adev->hw, vif->addr, ssid, ssid_len,
59                 req->ie_len);
60         if (!skb) {
61                 ret = -ENOMEM;
62 --- a/main.h
63 +++ b/main.h
64 @@ -62,7 +62,7 @@ void acx_op_tx(struct ieee80211_hw *hw,
65  #endif
66  
67  int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
68 -                   struct cfg80211_scan_request *req);
69 +                   struct ieee80211_scan_request *req);
70  
71  int acx_recover_hw(acx_device_t *adev);
72  
73 --- a/cardsetting.c
74 +++ b/cardsetting.c
75 @@ -159,7 +159,7 @@ int acx_set_channel(acx_device_t *adev,
76         int res = 0;
77  
78         adev->rx_status.freq = freq;
79 -       adev->rx_status.band = IEEE80211_BAND_2GHZ;
80 +       adev->rx_status.band = NL80211_BAND_2GHZ;
81  
82         adev->channel = channel;
83  
84 --- a/merge.c
85 +++ b/merge.c
86 @@ -2776,7 +2776,10 @@ void acx_irq_work(struct work_struct *wo
87                 /* HOST_INT_SCAN_COMPLETE */
88                 if (irqmasked & HOST_INT_SCAN_COMPLETE) {
89                         if (test_bit(ACX_FLAG_SCANNING, &adev->flags)) {
90 -                               ieee80211_scan_completed(adev->hw, false);
91 +                               struct cfg80211_scan_info info = {
92 +                                       .aborted = false
93 +                               };
94 +                               ieee80211_scan_completed(adev->hw, &info);
95                                 log(L_INIT, "scan completed\n");
96                                 clear_bit(ACX_FLAG_SCANNING, &adev->flags);
97                         }
98 @@ -3138,10 +3141,13 @@ int acx_op_start(struct ieee80211_hw *hw
99  
100  void acx_stop(acx_device_t *adev)
101  {
102 +       struct cfg80211_scan_info info = {
103 +               .aborted = true
104 +       };
105         acxmem_lock_flags;
106  
107         if (test_bit(ACX_FLAG_SCANNING, &adev->flags)) {
108 -               ieee80211_scan_completed(adev->hw, true);
109 +               ieee80211_scan_completed(adev->hw, &info);
110                 acx_issue_cmd(adev, ACX1xx_CMD_STOP_SCAN, NULL, 0);
111                 clear_bit(ACX_FLAG_SCANNING, &adev->flags);
112         }