ソースを参照

qcacld-3.0: Do not enable BPF offload if vdev is not up

Add sanity check to reject BPF enable request if vdev is not up.

Change-Id: Id5c35811308b0dd6e360fd9d0e0262c35b63929f
CRs-Fixed: 2097134
Rajeev Kumar 7 年 前
コミット
900160260d
1 ファイル変更19 行追加0 行削除
  1. 19 0
      core/wma/src/wma_features.c

+ 19 - 0
core/wma/src/wma_features.c

@@ -4576,6 +4576,23 @@ QDF_STATUS wma_set_bpf_instructions(tp_wma_handle wma,
 		return QDF_STATUS_E_NOSUPPORT;
 	}
 
+	if (!bpf_set_offload) {
+		WMA_LOGE("%s: Invalid BPF instruction request", __func__);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	if (bpf_set_offload->session_id >= wma->max_bssid) {
+		WMA_LOGE(FL("Invalid vdev_id: %d"),
+			bpf_set_offload->session_id);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	if (!wma_is_vdev_up(bpf_set_offload->session_id)) {
+		WMA_LOGE("vdev %d is not up skipping BPF offload",
+			bpf_set_offload->session_id);
+		return QDF_STATUS_E_INVAL;
+	}
+
 	if (bpf_set_offload->total_length) {
 		len_aligned = roundup(bpf_set_offload->current_length,
 					sizeof(A_UINT32));
@@ -4617,6 +4634,8 @@ QDF_STATUS wma_set_bpf_instructions(tp_wma_handle wma,
 		wmi_buf_free(wmi_buf);
 		return QDF_STATUS_E_FAILURE;
 	}
+	WMA_LOGD(FL("BPF offload enabled in fw"));
+
 	return QDF_STATUS_SUCCESS;
 }