All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Jun <chenjun102@huawei.com>
To: <stable@vger.kernel.org>, <gregkh@linuxfoundation.org>
Cc: <xuqiang36@huawei.com>
Subject: [PATCH stable 4.9 0/4] Fix CVE-2021-33655
Date: Thu, 4 Aug 2022 08:14:05 +0000	[thread overview]
Message-ID: <20220804081409.121787-1-chenjun102@huawei.com> (raw)

refer to https://lore.kernel.org/all/20220706150253.2186-1-deller@gmx.de/
3 patches are provided to fix CVE-2021-33655 (When sending malicous data
to kernel by ioctl cmd FBIOPUT_VSCREENINFO,kernel will write memory out
of bounds. https://nvd.nist.gov/vuln/detail/CVE-2021-33655) in mainline.

The problem exists in 4.9

static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
	fb_set_var(info, &var);
		fb_notifier_call_chain(evnt, &event); // evnt = FB_EVENT_MODE_CHANGE

static int fbcon_event_notify(struct notifier_block *self,
			      unsigned long action, void *data)
	fbcon_modechanged(info);
		updatescrollmode(p, info, vc);
			...
			p->vrows = vyres/fh;
			if (yres > (fh * (vc->vc_rows + 1)))
				p->vrows -= (yres - (fh * vc->vc_rows)) / fh;
			if ((yres % fh) && (vyres % fh < yres % fh))
				p->vrows--;	[1]
[1]: p->vrows could be -1, like what CVE-2021-33655 described.

To fix it, backport the three patches.

d48de54a9dab ("printk: Export is_console_locked") should also be backported
to avoid building failed if CONFIG_FB = m.

Hans de Goede (1):
  printk: Export is_console_locked

Helge Deller (3):
  fbmem: Check virtual screen sizes in fb_set_var()
  fbcon: Disallow setting font bigger than screen size
  fbcon: Prevent that screen size is smaller than font size

 drivers/video/console/fbcon.c    | 33 ++++++++++++++++++++++++++++++++
 drivers/video/fbdev/core/fbmem.c | 20 ++++++++++++++++---
 include/linux/fbcon.h            | 12 ++++++++++++
 kernel/printk/printk.c           |  1 +
 4 files changed, 63 insertions(+), 3 deletions(-)
 create mode 100644 include/linux/fbcon.h

-- 
2.17.1


             reply	other threads:[~2022-08-04  8:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04  8:14 Chen Jun [this message]
2022-08-04  8:14 ` [PATCH stable 4.9 1/4] printk: Export is_console_locked Chen Jun
2022-08-04  8:14 ` [PATCH stable 4.9 2/4] fbmem: Check virtual screen sizes in fb_set_var() Chen Jun
2022-08-04  8:14 ` [PATCH stable 4.9 3/4] fbcon: Disallow setting font bigger than screen size Chen Jun
2022-08-04  8:14 ` [PATCH stable 4.9 4/4] fbcon: Prevent that screen size is smaller than font size Chen Jun

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=20220804081409.121787-1-chenjun102@huawei.com \
    --to=chenjun102@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=stable@vger.kernel.org \
    --cc=xuqiang36@huawei.com \
    /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.