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
This commit is contained in:
Venkata Sharath Chandra Manchala
2019-08-07 15:59:27 -07:00
committed by nshrivas
parent 851c69d5bb
commit c0980fd21e
3 changed files with 11 additions and 2 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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