From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin King <colin.king@canonical.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>, Ingo Molnar <mingo@kernel.org>,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty: vt: keyboard: add range check to kbs->kb_func index
Date: Thu, 21 Sep 2017 02:40:52 +0300 [thread overview]
Message-ID: <20170920234052.euqzh6opnn27nxth@mwanda> (raw)
In-Reply-To: <20170920213828.5563-1-colin.king@canonical.com>
On Wed, Sep 20, 2017 at 10:38:28PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> A value outside the range 0..MAX_NR_FUNC-1 in kbs->kb_func will
> cause an array bounds overflow on func_table. Fix this by adding
> a range check.
>
> Detected by CoverityScan, CID#401961 ("Untrusted array index read")
>
> Fixes: 079c9534a96d ("vt:tackle kbd_table")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/tty/vt/keyboard.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
> index f4166263bb3a..1ecf545a96a8 100644
> --- a/drivers/tty/vt/keyboard.c
> +++ b/drivers/tty/vt/keyboard.c
> @@ -1982,6 +1982,11 @@ int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)
> kbs->kb_string[sizeof(kbs->kb_string)-1] = '\0';
> i = kbs->kb_func;
>
> + if (i < 0 || i >= MAX_NR_FUNC) {
kbs->kb_func is an unsigned char and MAX_NR_FUNC is 256 so this check
will never be true.
regards,
dan carpenter
prev parent reply other threads:[~2017-09-20 23:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 21:38 Colin King
2017-09-20 23:40 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170920234052.euqzh6opnn27nxth@mwanda \
--to=dan.carpenter@oracle.com \
--cc=colin.king@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®