summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CORE/HDD/src/wlan_hdd_cfg80211.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 1e40d7fe4af7..a1d867b64f1f 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -10058,6 +10058,7 @@ static int hdd_set_reset_bpf_offload(hdd_context_t *hdd_ctx,
struct sir_bpf_set_offload *bpf_set_offload;
eHalStatus hstatus;
int prog_len;
+ int ret_val = -EINVAL;
ENTER();
@@ -10097,6 +10098,11 @@ static int hdd_set_reset_bpf_offload(hdd_context_t *hdd_ctx,
prog_len = nla_len(tb[BPF_PROGRAM]);
bpf_set_offload->program = vos_mem_malloc(sizeof(uint8_t) * prog_len);
+ if (!bpf_set_offload->program) {
+ hddLog(LOGE, FL("failed to allocate memory for bpf filter"));
+ ret_val = -ENOMEM;
+ goto fail;
+ }
bpf_set_offload->current_length = prog_len;
nla_memcpy(bpf_set_offload->program, tb[BPF_PROGRAM], prog_len);
bpf_set_offload->session_id = adapter->sessionId;
@@ -10140,7 +10146,7 @@ fail:
if (bpf_set_offload->current_length)
vos_mem_free(bpf_set_offload->program);
vos_mem_free(bpf_set_offload);
- return -EINVAL;
+ return ret_val;
}
/**