summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrhan K AKYILDIZ <oka@codeaurora.org>2016-11-29 19:30:04 -0800
committerqcabuildsw <qcabuildsw@localhost>2016-12-16 10:25:18 -0800
commitf101fc73859ad43d227b7108644b9cd3edc22ef0 (patch)
tree4ab73af3f2ac21c24d078e7dd3d2b7eda023257d
parentf339496083e2f49d7222467efa3d6d71baf8c05e (diff)
qcacmn: Harden NAPI event handler
Make sure that NAPI event handler would handle events only after it has been initialized. Check init flag before procesing the event and emit a warning and return an error to the caller. Change-Id: I9d2b84560ee2363ecf2a570dbef0275dfb87786a CRs-Fixed: 1091678
-rw-r--r--hif/src/hif_napi.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hif/src/hif_napi.c b/hif/src/hif_napi.c
index f7fc8131b6e2..1269ecb7d079 100644
--- a/hif/src/hif_napi.c
+++ b/hif/src/hif_napi.c
@@ -476,6 +476,11 @@ int hif_napi_event(struct hif_opaque_softc *hif_ctx, enum qca_napi_event event,
NAPI_DEBUG("%s: -->(event=%d, aux=%p)", __func__, event, data);
+ if ((napid->state & HIF_NAPI_INITED) == 0) {
+ NAPI_DEBUG("%s: got event when NAPI not initialized",
+ __func__);
+ return -EINVAL;
+ }
spin_lock_bh(&(napid->lock));
prev_state = napid->state;
switch (event) {