qcacmn: Add a check to avoid processing invalid pktlog buffers

Avoid further processing of pktlog buffers received from
firmware or Hardware if the size is greater than
MAX_PKTLOG_RECV_BUF_SIZE.

Change-Id: If1dd855137a9b83721f01005fa3367f7924f4ebb
CRs-Fixed: 2493721
此提交包含在:
Venkata Sharath Chandra Manchala
2019-08-07 15:59:27 -07:00
提交者 nshrivas
父節點 851c69d5bb
當前提交 c0980fd21e
共有 3 個檔案被更改,包括 11 行新增2 行删除

查看文件

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -102,6 +102,7 @@ struct pktlog_dev_t {
void *htc_pdev; void *htc_pdev;
bool vendor_cmd_send; bool vendor_cmd_send;
uint8_t callback_type; uint8_t callback_type;
uint32_t invalid_packets;
}; };
#define PKTLOG_SYSCTL_SIZE 14 #define PKTLOG_SYSCTL_SIZE 14

查看文件

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -33,6 +33,9 @@
#define PKTLOG_DEFAULT_PHYERR_THRESH 300 #define PKTLOG_DEFAULT_PHYERR_THRESH 300
#define PKTLOG_DEFAULT_TRIGGER_INTERVAL 500 #define PKTLOG_DEFAULT_TRIGGER_INTERVAL 500
/* Max Pktlog buffer size received from fw/hw */
#define MAX_PKTLOG_RECV_BUF_SIZE 2048
struct ath_pktlog_arg { struct ath_pktlog_arg {
struct ath_pktlog_info *pl_info; struct ath_pktlog_info *pl_info;
uint32_t flags; uint32_t flags;

查看文件

@@ -685,6 +685,11 @@ process_offload_pktlog(struct cdp_pdev *pdev, void *data)
pl_hdr.type_specific_data = *(pl_tgt_hdr pl_hdr.type_specific_data = *(pl_tgt_hdr
+ ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET); + ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET);
if (pl_hdr.size > MAX_PKTLOG_RECV_BUF_SIZE) {
pl_dev->invalid_packets++;
return A_ERROR;
}
/* /*
* Must include to process different types * Must include to process different types
* TX_CTL, TX_STATUS, TX_MSDU_ID, TX_FRM_HDR * TX_CTL, TX_STATUS, TX_MSDU_ID, TX_FRM_HDR