diff --git a/utils/pktlog/include/pktlog_ac.h b/utils/pktlog/include/pktlog_ac.h index afa5f3d64d..f61358545b 100644 --- a/utils/pktlog/include/pktlog_ac.h +++ b/utils/pktlog/include/pktlog_ac.h @@ -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 * any purpose with or without fee is hereby granted, provided that the @@ -102,6 +102,7 @@ struct pktlog_dev_t { void *htc_pdev; bool vendor_cmd_send; uint8_t callback_type; + uint32_t invalid_packets; }; #define PKTLOG_SYSCTL_SIZE 14 diff --git a/utils/pktlog/include/pktlog_ac_i.h b/utils/pktlog/include/pktlog_ac_i.h index 9c8cb5f64c..c9e0101eaa 100644 --- a/utils/pktlog/include/pktlog_ac_i.h +++ b/utils/pktlog/include/pktlog_ac_i.h @@ -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 * 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_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_info *pl_info; uint32_t flags; diff --git a/utils/pktlog/pktlog_internal.c b/utils/pktlog/pktlog_internal.c index 8f3a043c1d..c541feffa4 100644 --- a/utils/pktlog/pktlog_internal.c +++ b/utils/pktlog/pktlog_internal.c @@ -685,6 +685,11 @@ process_offload_pktlog(struct cdp_pdev *pdev, void *data) pl_hdr.type_specific_data = *(pl_tgt_hdr + 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 * TX_CTL, TX_STATUS, TX_MSDU_ID, TX_FRM_HDR