Browse Source

qcacld-3.0: Use static contexts when checking magic of stack memory

The kernel is unmapping the virtual address of memory allocated on the stack.
To avoid kernel page fault when delayed handlers try to check the out of scope
structures magic value for liveness, make the contexts static.

A better solution is under development but will need more testing.

Below hdd functions are taken care of:
hdd_get_bpf_offload
hdd_get_tsm_stats
wlan_hdd_get_link_status
wlan_hdd_get_rssi
wlan_hdd_get_snr
wlan_hdd_get_linkspeed_for_peermac
wlan_hdd_get_class_astats
wlan_hdd_get_temperature

Change-Id: I9b6decba1087e2d30f1572cc9d020b2b0cb5cec4
CRs-Fixed: 1087903
Houston Hoffman 8 years ago
parent
commit
59c097f489
3 changed files with 8 additions and 8 deletions
  1. 1 1
      core/hdd/src/wlan_hdd_cfg80211.c
  2. 2 2
      core/hdd/src/wlan_hdd_ioctl.c
  3. 5 5
      core/hdd/src/wlan_hdd_wext.c

+ 1 - 1
core/hdd/src/wlan_hdd_cfg80211.c

@@ -6437,7 +6437,7 @@ nla_put_failure:
 static int hdd_get_bpf_offload(hdd_context_t *hdd_ctx)
 {
 	unsigned long rc;
-	struct hdd_bpf_context *context;
+	static struct hdd_bpf_context *context;
 	QDF_STATUS status;
 	int ret;
 

+ 2 - 2
core/hdd/src/wlan_hdd_ioctl.c

@@ -198,7 +198,7 @@ QDF_STATUS hdd_get_tsm_stats(hdd_adapter_t *adapter,
 	QDF_STATUS hstatus;
 	QDF_STATUS vstatus = QDF_STATUS_SUCCESS;
 	unsigned long rc;
-	struct statsContext context;
+	static struct statsContext context;
 	hdd_context_t *hdd_ctx = NULL;
 
 	if (NULL == adapter) {
@@ -2422,7 +2422,7 @@ static int wlan_hdd_get_link_status(hdd_adapter_t *adapter)
 
 	hdd_station_ctx_t *pHddStaCtx =
 				WLAN_HDD_GET_STATION_CTX_PTR(adapter);
-	struct statsContext context;
+	static struct statsContext context;
 	QDF_STATUS hstatus;
 	unsigned long rc;
 

+ 5 - 5
core/hdd/src/wlan_hdd_wext.c

@@ -1222,7 +1222,7 @@ static void hdd_get_snr_cb(int8_t snr, uint32_t staId, void *pContext)
  */
 QDF_STATUS wlan_hdd_get_rssi(hdd_adapter_t *pAdapter, int8_t *rssi_value)
 {
-	struct statsContext context;
+	static struct statsContext context;
 	hdd_context_t *pHddCtx;
 	hdd_station_ctx_t *pHddStaCtx;
 	QDF_STATUS hstatus;
@@ -1308,7 +1308,7 @@ QDF_STATUS wlan_hdd_get_rssi(hdd_adapter_t *pAdapter, int8_t *rssi_value)
  */
 QDF_STATUS wlan_hdd_get_snr(hdd_adapter_t *pAdapter, int8_t *snr)
 {
-	struct statsContext context;
+	static struct statsContext context;
 	hdd_context_t *pHddCtx;
 	hdd_station_ctx_t *pHddStaCtx;
 	QDF_STATUS hstatus;
@@ -1455,7 +1455,7 @@ QDF_STATUS wlan_hdd_get_linkspeed_for_peermac(hdd_adapter_t *pAdapter,
 					      struct qdf_mac_addr macAddress) {
 	QDF_STATUS status;
 	unsigned long rc;
-	struct linkspeedContext context;
+	static struct linkspeedContext context;
 	tSirLinkSpeedInfo *linkspeed_req;
 
 	if (NULL == pAdapter) {
@@ -3649,7 +3649,7 @@ QDF_STATUS wlan_hdd_get_class_astats(hdd_adapter_t *pAdapter)
 	hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
 	QDF_STATUS hstatus;
 	unsigned long rc;
-	struct statsContext context;
+	static struct statsContext context;
 
 	if (NULL == pAdapter) {
 		hdd_err("pAdapter is NULL");
@@ -5138,7 +5138,7 @@ static void hdd_get_temperature_cb(int temperature, void *pContext)
 int wlan_hdd_get_temperature(hdd_adapter_t *pAdapter, int *temperature)
 {
 	QDF_STATUS status;
-	struct statsContext tempContext;
+	static struct statsContext tempContext;
 	unsigned long rc;
 
 	ENTER();