From 725674586f5bc009ef5175d29eb0fd677e0ef1f2 Mon Sep 17 00:00:00 2001 From: "Poddar, Siddarth" Date: Mon, 3 Jul 2017 15:57:19 +0530 Subject: qcacld-2.0: Restrict max/min pktlog buffer size using pktlogconf tool Restrict the pktlog buffer size to a minimum of 1MB and maximum of 16MB using pktlogconf tool or through sysctl command. CRs-Fixed: 2064785 Change-Id: I2951de86de083b610bb114ff4b9ddcb51c4c3042 --- CORE/UTILS/PKTLOG/pktlog_ac.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CORE/UTILS/PKTLOG/pktlog_ac.c b/CORE/UTILS/PKTLOG/pktlog_ac.c index 823d2d5..679a78c 100644 --- a/CORE/UTILS/PKTLOG/pktlog_ac.c +++ b/CORE/UTILS/PKTLOG/pktlog_ac.c @@ -424,14 +424,22 @@ int pktlog_enable(struct ol_softc *scn, int32_t log_state) return error; } +#define ONE_MEGABYTE (1024 * 1024) +#define MAX_ALLOWED_PKTLOG_SIZE (16 * ONE_MEGABYTE) static int __pktlog_setsize(struct ol_softc *scn, int32_t size) { struct ol_pktlog_dev_t *pl_dev = scn->pdev_txrx_handle->pl_dev; struct ath_pktlog_info *pl_info = pl_dev->pl_info; - if (size < 0) + + if (size < ONE_MEGABYTE || size > MAX_ALLOWED_PKTLOG_SIZE) { + printk("%s: Cannot Set Pktlog Buffer size of %d bytes." + "Min required is %d MB and Max allowed is %d MB.\n", + __func__, size, (ONE_MEGABYTE/ONE_MEGABYTE), + (MAX_ALLOWED_PKTLOG_SIZE/ONE_MEGABYTE)); return -EINVAL; + } if (size == pl_info->buf_size) return 0; -- cgit v1.1