diff options
author | Venkateswara Naralasetty <vnaralas@codeaurora.org> | 2018-04-25 11:36:40 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2018-04-27 14:24:25 +0300 |
commit | 2f177c1628c3f54cdfcc8093cd4b5297f4baeec4 (patch) | |
tree | 6399bb34bb6c4ac5d1dc5a31c87251b2f7bb9f37 /drivers/net/wireless/ath/ath10k/debug.c | |
parent | 51c12756de427ee0ff90e2f00e121d2f5311c140 (diff) | |
download | linux-2f177c1628c3f54cdfcc8093cd4b5297f4baeec4.tar.gz linux-2f177c1628c3f54cdfcc8093cd4b5297f4baeec4.tar.bz2 linux-2f177c1628c3f54cdfcc8093cd4b5297f4baeec4.zip |
ath10k: fix information leak in debugfs
During write to some of debugfs in ath10k, few variables exposing stack
data when process user input. which leads to possible information leak.
This patch fix this issue by initializing buffer and checks
the return valure of 'simple_write_to_buffer'.
Signed-off-by: Venkateswara Naralasetty <vnaralas@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/ath/ath10k/debug.c')
-rw-r--r-- | drivers/net/wireless/ath/ath10k/debug.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index bac832ce1873..57d22cd976e5 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -987,13 +987,13 @@ static ssize_t ath10k_write_htt_max_amsdu_ampdu(struct file *file, { struct ath10k *ar = file->private_data; int res; - char buf[64]; + char buf[64] = {0}; unsigned int amsdu, ampdu; - simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); - - /* make sure that buf is null terminated */ - buf[sizeof(buf) - 1] = 0; + res = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, + user_buf, count); + if (res <= 0) + return res; res = sscanf(buf, "%u %u", &amsdu, &du); @@ -1043,14 +1043,14 @@ static ssize_t ath10k_write_fw_dbglog(struct file *file, { struct ath10k *ar = file->private_data; int ret; - char buf[96]; + char buf[96] = {0}; unsigned int log_level; u64 mask; - simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); - - /* make sure that buf is null terminated */ - buf[sizeof(buf) - 1] = 0; + ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, + user_buf, count); + if (ret <= 0) + return ret; ret = sscanf(buf, "%llx %u", &mask, &log_level); |