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
This commit is contained in:

committed by
Houston Hoffman

parent
93e24e385d
commit
0f521bf9be
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
|
* Copyright (c) 2015-2017 The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
||||||
*
|
*
|
||||||
@@ -468,6 +468,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);
|
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));
|
spin_lock_bh(&(napid->lock));
|
||||||
prev_state = napid->state;
|
prev_state = napid->state;
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
Reference in New Issue
Block a user