mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 00:00:00 -04:00
qcacld-3.0: Return error for invalid wow pattern
qcacld-2.0 to qcacld-3.0 propagation Return error from driver whenever user sends invalid wow pattern via iwpriv command Change-Id: Iacf84986e95ed3f156fd588d5c855654c3541a89 CRs-Fixed: 2299629
This commit is contained in:
parent
508bc0a223
commit
16214ffbe8
2 changed files with 19 additions and 7 deletions
|
|
@ -5523,11 +5523,13 @@ static int __iw_setchar_getnone(struct net_device *dev,
|
|||
switch (sub_cmd) {
|
||||
case WE_WOWL_ADD_PTRN:
|
||||
hdd_debug("ADD_PTRN");
|
||||
hdd_add_wowl_ptrn(adapter, str_arg);
|
||||
if (!hdd_add_wowl_ptrn(adapter, str_arg))
|
||||
return -EINVAL;
|
||||
break;
|
||||
case WE_WOWL_DEL_PTRN:
|
||||
hdd_debug("DEL_PTRN");
|
||||
hdd_del_wowl_ptrn(adapter, str_arg);
|
||||
if (!hdd_del_wowl_ptrn(adapter, str_arg))
|
||||
return -EINVAL;
|
||||
break;
|
||||
case WE_NEIGHBOR_REPORT_REQUEST:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ bool hdd_add_wowl_ptrn(struct hdd_adapter *adapter, const char *ptrn)
|
|||
uint8_t sessionId = adapter->session_id;
|
||||
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
uint8_t num_filters;
|
||||
bool invalid_ptrn = false;
|
||||
|
||||
status = hdd_get_num_wow_filters(hdd_ctx, &num_filters);
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
|
|
@ -127,11 +128,13 @@ bool hdd_add_wowl_ptrn(struct hdd_adapter *adapter, const char *ptrn)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!memcmp(ptrn, g_hdd_wowl_ptrns[i], len)) {
|
||||
hdd_err("WoWL pattern '%s' already configured",
|
||||
g_hdd_wowl_ptrns[i]);
|
||||
ptrn += len;
|
||||
goto next_ptrn;
|
||||
if (strlen(g_hdd_wowl_ptrns[i]) == len) {
|
||||
if (!memcmp(ptrn, g_hdd_wowl_ptrns[i], len)) {
|
||||
hdd_err("WoWL pattern '%s' already configured",
|
||||
g_hdd_wowl_ptrns[i]);
|
||||
ptrn += len;
|
||||
goto next_ptrn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -145,6 +148,7 @@ bool hdd_add_wowl_ptrn(struct hdd_adapter *adapter, const char *ptrn)
|
|||
if (ptrn[2] != WOWL_INTRA_PTRN_TOKENIZER ||
|
||||
ptrn[5] != WOWL_INTRA_PTRN_TOKENIZER) {
|
||||
hdd_err("Malformed pattern string. Skip!");
|
||||
invalid_ptrn = true;
|
||||
ptrn += len;
|
||||
goto next_ptrn;
|
||||
}
|
||||
|
|
@ -161,6 +165,7 @@ bool hdd_add_wowl_ptrn(struct hdd_adapter *adapter, const char *ptrn)
|
|||
|| localPattern.pattern_mask_size >
|
||||
WOWL_PTRN_MASK_MAX_SIZE) {
|
||||
hdd_err("Invalid length specified. Skip!");
|
||||
invalid_ptrn = true;
|
||||
ptrn += len;
|
||||
goto next_ptrn;
|
||||
}
|
||||
|
|
@ -170,6 +175,7 @@ bool hdd_add_wowl_ptrn(struct hdd_adapter *adapter, const char *ptrn)
|
|||
if ((offset >= len) ||
|
||||
(ptrn[offset] != WOWL_INTRA_PTRN_TOKENIZER)) {
|
||||
hdd_err("Malformed pattern string..skip!");
|
||||
invalid_ptrn = true;
|
||||
ptrn += len;
|
||||
goto next_ptrn;
|
||||
}
|
||||
|
|
@ -179,6 +185,7 @@ bool hdd_add_wowl_ptrn(struct hdd_adapter *adapter, const char *ptrn)
|
|||
if (offset + 1 != len) {
|
||||
/* offset begins with 0 */
|
||||
hdd_err("Malformed pattern string...skip!");
|
||||
invalid_ptrn = true;
|
||||
ptrn += len;
|
||||
goto next_ptrn;
|
||||
}
|
||||
|
|
@ -244,6 +251,9 @@ next_ptrn:
|
|||
}
|
||||
}
|
||||
|
||||
if (invalid_ptrn)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue