All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roel Kluin <roel.kluin@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] vt: Don't exceed max_font_size on copy in con_font_get()
Date: Mon, 23 Nov 2009 21:23:42 +0100	[thread overview]
Message-ID: <4B0AEF4E.8070005@gmail.com> (raw)

font.data is kmallocd with max_font_size (defined 65536). Below occurs a
copy_to_user with `c' as a size argument. Ensure we don't copy too much.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
 drivers/char/vt.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

If it is possible for c to be greater than 65536 then I think we may need this.
Correct?

diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 0c80c68..045af83 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -3861,6 +3861,10 @@ static int con_font_get(struct vc_data *vc, struct console_font_op *op)
 		goto out;
 
 	c = (font.width+7)/8 * 32 * font.charcount;
+	if (c > max_font_size) {
+		rc = -EINVAL;
+		goto out;
+	}
 
 	if (op->data && font.charcount > op->charcount)
 		rc = -ENOSPC;

             reply	other threads:[~2009-11-23 20:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-23 20:23 Roel Kluin [this message]
2009-11-24  2:46 ` [PATCH] vt: Don't exceed max_font_size on copy in con_font_get() Andrew Morton

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=4B0AEF4E.8070005@gmail.com \
    --to=roel.kluin@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.