summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiaoqing Pan <miaoqing@codeaurora.org>2017-09-27 09:13:34 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-20 10:01:34 +0100
commit07aa0bc0072e49c71caad90a3ab74aa34ccd64e4 (patch)
tree9e1ee453de40832c2e0f95950ebb0e52f53f310c
parent2d7c1288825f5c6fc85502d3a32bb1a9806354ff (diff)
downloadlinux-stable-07aa0bc0072e49c71caad90a3ab74aa34ccd64e4.tar.gz
linux-stable-07aa0bc0072e49c71caad90a3ab74aa34ccd64e4.tar.bz2
linux-stable-07aa0bc0072e49c71caad90a3ab74aa34ccd64e4.zip
ath9k: fix tx99 potential info leak
[ Upstream commit ee0a47186e2fa9aa1c56cadcea470ca0ba8c8692 ] When the user sets count to zero the string buffer would remain completely uninitialized which causes the kernel to parse its own stack data, potentially leading to an info leak. In addition to that, the string might be not terminated properly when the user data does not contain a 0-terminator. Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org> Reviewed-by: Christoph Böhmwalder <christoph@boehmwalder.at> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/wireless/ath/ath9k/tx99.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/tx99.c b/drivers/net/wireless/ath/ath9k/tx99.c
index 2ea3589f709f..b7ab8455ffbd 100644
--- a/drivers/net/wireless/ath/ath9k/tx99.c
+++ b/drivers/net/wireless/ath/ath9k/tx99.c
@@ -180,6 +180,9 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf,
ssize_t len;
int r;
+ if (count < 1)
+ return -EINVAL;
+
if (sc->cur_chan->nvifs > 1)
return -EOPNOTSUPP;
@@ -187,6 +190,8 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf,
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
+ buf[len] = '\0';
+
if (strtobool(buf, &start))
return -EINVAL;