DivestOS/Patches/Linux_CVEs-New/CVE-2017-11050/ANY/1.patch
2017-10-29 14:23:02 -04:00

46 lines
1.6 KiB
Diff

From 4d7233954031dcb34e08fb4f6a82fc3e9f08ce12 Mon Sep 17 00:00:00 2001
From: "Poddar, Siddarth" <siddpodd@codeaurora.org>
Date: Mon, 3 Jul 2017 15:57:19 +0530
Subject: [PATCH] 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.
Bug: 62085265
CRs-Fixed: 2064785
Change-Id: I2951de86de083b610bb114ff4b9ddcb51c4c3042
Signed-off-by: Ecco Park <eccopark@google.com>
---
drivers/staging/qcacld-2.0/CORE/UTILS/PKTLOG/pktlog_ac.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/qcacld-2.0/CORE/UTILS/PKTLOG/pktlog_ac.c b/drivers/staging/qcacld-2.0/CORE/UTILS/PKTLOG/pktlog_ac.c
index 3d38ca44617d6..542ff90ba5952 100644
--- a/drivers/staging/qcacld-2.0/CORE/UTILS/PKTLOG/pktlog_ac.c
+++ b/drivers/staging/qcacld-2.0/CORE/UTILS/PKTLOG/pktlog_ac.c
@@ -389,14 +389,22 @@ pktlog_enable(struct ol_softc *scn, int32_t log_state)
return 0;
}
+#define ONE_MEGABYTE (1024 * 1024)
+#define MAX_ALLOWED_PKTLOG_SIZE (16 * ONE_MEGABYTE)
+
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;