Skip to content

Commit

Permalink
ath9k: fix tx99 potential info leak
Browse files Browse the repository at this point in the history
[ Upstream commit ee0a471 ]

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>
  • Loading branch information
Miaoqing Pan authored and Greg Kroah-Hartman committed Dec 20, 2017
1 parent 99ab42f commit e37eb54
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/wireless/ath/ath9k/tx99.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,18 @@ 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;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;

buf[len] = '\0';

if (strtobool(buf, &start))
return -EINVAL;

Expand Down

0 comments on commit e37eb54

Please sign in to comment.