[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200901212257.GB17861@duo.ucw.cz>
Date: Tue, 1 Sep 2020 23:22:57 +0200
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
George Kennedy <george.kennedy@...cle.com>,
syzbot+38a3699c7eaf165b97a6@...kaller.appspotmail.com
Subject: Re: [PATCH 4.19 085/125] fbcon: prevent user font height or width
change from causing potential out-of-bounds access
On Tue 2020-09-01 17:10:40, Greg Kroah-Hartman wrote:
> From: George Kennedy <george.kennedy@...cle.com>
>
> commit 39b3cffb8cf3111738ea993e2757ab382253d86a upstream.
>
> Add a check to fbcon_resize() to ensure that a possible change to user font
> height or user font width will not allow a font data out-of-bounds access.
> NOTE: must use original charcount in calculation as font charcount can
> change and cannot be used to determine the font data allocated size.
> +#define PITCH(w) (((w) + 7) >> 3)
> +#define CALC_FONTSZ(h, p, c) ((h) * (p) * (c)) /* size = height * pitch * charcount */
Ok, so we validate data from user. Can this overflow? Should it be
inline function for readability?
> static int fbcon_resize(struct vc_data *vc, unsigned int width,
> unsigned int height, unsigned int user)
> {
> @@ -2161,6 +2164,24 @@ static int fbcon_resize(struct vc_data *
> struct fb_var_screeninfo var = info->var;
> int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh;
>
> + if (ops->p && ops->p->userfont && FNTSIZE(vc->vc_font.data)) {
> + int size;
> + int pitch = PITCH(vc->vc_font.width);
Should size be unsigned?
Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists