2017-11-07 17:32:46 -05:00
|
|
|
From 2c7b4349b858398caf0ae146e87554c3502d20a5 Mon Sep 17 00:00:00 2001
|
2017-10-29 01:48:53 -04:00
|
|
|
From: Hamad Kadmany <hkadmany@codeaurora.org>
|
|
|
|
Date: Sun, 18 Dec 2016 15:03:11 +0200
|
|
|
|
Subject: wil6210: Block write ioctl to the card by default
|
|
|
|
|
|
|
|
The ability to write to the card is used for debug purposes.
|
|
|
|
The ability is disabled by default to prevent misuse of
|
|
|
|
this functionality.
|
|
|
|
|
|
|
|
CRs-Fixed: 1096945
|
|
|
|
Change-Id: I8fc3f646a0127ec705239be6a7de858a4f805acc
|
|
|
|
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
|
|
|
|
---
|
|
|
|
drivers/net/wireless/ath/wil6210/Kconfig | 11 +++++++++++
|
|
|
|
drivers/net/wireless/ath/wil6210/ioctl.c | 4 ++++
|
|
|
|
2 files changed, 15 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/drivers/net/wireless/ath/wil6210/Kconfig b/drivers/net/wireless/ath/wil6210/Kconfig
|
2017-11-07 17:32:46 -05:00
|
|
|
index 9e3961c..8f0bde5 100644
|
2017-10-29 01:48:53 -04:00
|
|
|
--- a/drivers/net/wireless/ath/wil6210/Kconfig
|
|
|
|
+++ b/drivers/net/wireless/ath/wil6210/Kconfig
|
2017-11-07 17:32:46 -05:00
|
|
|
@@ -41,6 +41,17 @@ config WIL6210_TRACING
|
2017-10-29 01:48:53 -04:00
|
|
|
|
|
|
|
If unsure, say Y to make it easier to debug problems.
|
|
|
|
|
|
|
|
+config WIL6210_WRITE_IOCTL
|
|
|
|
+ bool "wil6210 write ioctl to the device"
|
|
|
|
+ depends on WIL6210
|
|
|
|
+ default n
|
|
|
|
+ ---help---
|
|
|
|
+ Say Y here to allow write-access from user-space to
|
|
|
|
+ the device memory through ioctl. This is useful for
|
|
|
|
+ debugging purposes only.
|
|
|
|
+
|
|
|
|
+ If unsure, say N.
|
|
|
|
+
|
|
|
|
config WIL6210_PLATFORM_MSM
|
|
|
|
bool "wil6210 MSM platform specific support"
|
|
|
|
depends on WIL6210
|
|
|
|
diff --git a/drivers/net/wireless/ath/wil6210/ioctl.c b/drivers/net/wireless/ath/wil6210/ioctl.c
|
2017-11-07 17:32:46 -05:00
|
|
|
index 47058ccc..bbdd232 100644
|
2017-10-29 01:48:53 -04:00
|
|
|
--- a/drivers/net/wireless/ath/wil6210/ioctl.c
|
|
|
|
+++ b/drivers/net/wireless/ath/wil6210/ioctl.c
|
2017-11-07 17:32:46 -05:00
|
|
|
@@ -87,10 +87,12 @@ static int wil_ioc_memio_dword(struct wil6210_priv *wil, void __user *data)
|
|
|
|
io.val = readl(a);
|
2017-10-29 01:48:53 -04:00
|
|
|
need_copy = true;
|
|
|
|
break;
|
|
|
|
+#if defined(CONFIG_WIL6210_WRITE_IOCTL)
|
|
|
|
case wil_mmio_write:
|
2017-11-07 17:32:46 -05:00
|
|
|
writel(io.val, a);
|
2017-10-29 01:48:53 -04:00
|
|
|
wmb(); /* make sure write propagated to HW */
|
|
|
|
break;
|
|
|
|
+#endif
|
|
|
|
default:
|
|
|
|
wil_err(wil, "Unsupported operation, op = 0x%08x\n", io.op);
|
|
|
|
return -EINVAL;
|
2017-11-07 17:32:46 -05:00
|
|
|
@@ -147,6 +149,7 @@ static int wil_ioc_memio_block(struct wil6210_priv *wil, void __user *data)
|
2017-10-29 01:48:53 -04:00
|
|
|
goto out_free;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
+#if defined(CONFIG_WIL6210_WRITE_IOCTL)
|
|
|
|
case wil_mmio_write:
|
|
|
|
if (copy_from_user(block, io.block, io.size)) {
|
|
|
|
rc = -EFAULT;
|
2017-11-07 17:32:46 -05:00
|
|
|
@@ -156,6 +159,7 @@ static int wil_ioc_memio_block(struct wil6210_priv *wil, void __user *data)
|
2017-10-29 01:48:53 -04:00
|
|
|
wmb(); /* make sure write propagated to HW */
|
|
|
|
wil_hex_dump_ioctl("Write ", block, io.size);
|
|
|
|
break;
|
|
|
|
+#endif
|
|
|
|
default:
|
|
|
|
wil_err(wil, "Unsupported operation, op = 0x%08x\n", io.op);
|
|
|
|
rc = -EINVAL;
|
|
|
|
--
|
|
|
|
cgit v1.1
|
|
|
|
|