diff options
author | Jeff Disher <disher@chromium.org> | 2012-08-30 21:20:55 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-09-07 15:03:44 -0400 |
commit | 908fe11314be4744fb303179a1c46b22dcdc5b87 (patch) | |
tree | 98f7f7fa1270e08a3454919448918f78a71d7807 | |
parent | cbaa177d2b2f9364c7b9250d8ced75fae326c052 (diff) |
mwifiex: store mwifiex_ds_misc_subsc_evt in mwifiex_private
Since mwifiex_ds_misc_subsc_evt is used in an asynchronous case,
store the structure in the long-lived mwifiex_private instead of
on the calling stack.
This fixes a problem where the response of the asynchronous
operation would corrupt a stack frame potentially in use by
a different thread.
Signed-off-by: Jeff Disher <disher@chromium.org>
Reviewed-by: Sam Leffler <sleffler@chromium.org>
Tested-by: Jeff Disher <disher@chromium.org>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_cmdresp.c | 24 |
2 files changed, 14 insertions, 11 deletions
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index ede0c65dcb96..bb753903259e 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -484,6 +484,7 @@ struct mwifiex_private { | |||
484 | s32 cqm_rssi_thold; | 484 | s32 cqm_rssi_thold; |
485 | u32 cqm_rssi_hyst; | 485 | u32 cqm_rssi_hyst; |
486 | u8 subsc_evt_rssi_state; | 486 | u8 subsc_evt_rssi_state; |
487 | struct mwifiex_ds_misc_subsc_evt async_subsc_evt_storage; | ||
487 | struct mwifiex_ie mgmt_ie[MAX_MGMT_IE_INDEX]; | 488 | struct mwifiex_ie mgmt_ie[MAX_MGMT_IE_INDEX]; |
488 | u16 beacon_idx; | 489 | u16 beacon_idx; |
489 | u16 proberesp_idx; | 490 | u16 proberesp_idx; |
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c index 62223ab662ce..675c00bbe7d3 100644 --- a/drivers/net/wireless/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c | |||
@@ -123,7 +123,8 @@ static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv, | |||
123 | { | 123 | { |
124 | struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp = | 124 | struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp = |
125 | &resp->params.rssi_info_rsp; | 125 | &resp->params.rssi_info_rsp; |
126 | struct mwifiex_ds_misc_subsc_evt subsc_evt; | 126 | struct mwifiex_ds_misc_subsc_evt *subsc_evt = |
127 | &priv->async_subsc_evt_storage; | ||
127 | 128 | ||
128 | priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last); | 129 | priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last); |
129 | priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last); | 130 | priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last); |
@@ -140,26 +141,27 @@ static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv, | |||
140 | if (priv->subsc_evt_rssi_state == EVENT_HANDLED) | 141 | if (priv->subsc_evt_rssi_state == EVENT_HANDLED) |
141 | return 0; | 142 | return 0; |
142 | 143 | ||
144 | memset(subsc_evt, 0x00, sizeof(struct mwifiex_ds_misc_subsc_evt)); | ||
145 | |||
143 | /* Resubscribe low and high rssi events with new thresholds */ | 146 | /* Resubscribe low and high rssi events with new thresholds */ |
144 | memset(&subsc_evt, 0x00, sizeof(struct mwifiex_ds_misc_subsc_evt)); | 147 | subsc_evt->events = BITMASK_BCN_RSSI_LOW | BITMASK_BCN_RSSI_HIGH; |
145 | subsc_evt.events = BITMASK_BCN_RSSI_LOW | BITMASK_BCN_RSSI_HIGH; | 148 | subsc_evt->action = HostCmd_ACT_BITWISE_SET; |
146 | subsc_evt.action = HostCmd_ACT_BITWISE_SET; | ||
147 | if (priv->subsc_evt_rssi_state == RSSI_LOW_RECVD) { | 149 | if (priv->subsc_evt_rssi_state == RSSI_LOW_RECVD) { |
148 | subsc_evt.bcn_l_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg - | 150 | subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg - |
149 | priv->cqm_rssi_hyst); | 151 | priv->cqm_rssi_hyst); |
150 | subsc_evt.bcn_h_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold); | 152 | subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold); |
151 | } else if (priv->subsc_evt_rssi_state == RSSI_HIGH_RECVD) { | 153 | } else if (priv->subsc_evt_rssi_state == RSSI_HIGH_RECVD) { |
152 | subsc_evt.bcn_l_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold); | 154 | subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold); |
153 | subsc_evt.bcn_h_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg + | 155 | subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg + |
154 | priv->cqm_rssi_hyst); | 156 | priv->cqm_rssi_hyst); |
155 | } | 157 | } |
156 | subsc_evt.bcn_l_rssi_cfg.evt_freq = 1; | 158 | subsc_evt->bcn_l_rssi_cfg.evt_freq = 1; |
157 | subsc_evt.bcn_h_rssi_cfg.evt_freq = 1; | 159 | subsc_evt->bcn_h_rssi_cfg.evt_freq = 1; |
158 | 160 | ||
159 | priv->subsc_evt_rssi_state = EVENT_HANDLED; | 161 | priv->subsc_evt_rssi_state = EVENT_HANDLED; |
160 | 162 | ||
161 | mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11_SUBSCRIBE_EVENT, | 163 | mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11_SUBSCRIBE_EVENT, |
162 | 0, 0, &subsc_evt); | 164 | 0, 0, subsc_evt); |
163 | 165 | ||
164 | return 0; | 166 | return 0; |
165 | } | 167 | } |