Commit 5e3d791e authored by Miaoqing Pan's avatar Miaoqing Pan Committed by Kleber Sacilotto de Souza

ath9k: fix tx99 potential info leak

BugLink: http://bugs.launchpad.net/bugs/1745052

[ Upstream commit ee0a4718 ]

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: default avatarMiaoqing Pan <miaoqing@codeaurora.org>
Reviewed-by: default avatarChristoph Böhmwalder <christoph@boehmwalder.at>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 0911705c
...@@ -180,6 +180,9 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf, ...@@ -180,6 +180,9 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf,
ssize_t len; ssize_t len;
int r; int r;
if (count < 1)
return -EINVAL;
if (sc->cur_chan->nvifs > 1) if (sc->cur_chan->nvifs > 1)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -187,6 +190,8 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf, ...@@ -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)) if (copy_from_user(buf, user_buf, len))
return -EFAULT; return -EFAULT;
buf[len] = '\0';
if (strtobool(buf, &start)) if (strtobool(buf, &start))
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment