All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	Daniel Vetter <daniel@ffwll.ch>,
	Shigeru Yoshida <syoshida@redhat.com>
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] fbdev: fbcon: release buffer when fbcon_do_set_font() failed
Date: Sat, 10 Dec 2022 17:18:51 +0100	[thread overview]
Message-ID: <8a045252-f169-6d61-9c52-860f8a9d0b00@gmx.de> (raw)
In-Reply-To: <d37c0147-3605-a876-9b85-16bcbc05eaa6@I-love.SAKURA.ne.jp>

On 12/5/22 23:10, Tetsuo Handa wrote:
> syzbot is reporting memory leak at fbcon_do_set_font() [1], for
> commit a5a923038d70 ("fbdev: fbcon: Properly revert changes when
> vc_resize() failed") missed that the buffer might be newly allocated
> by fbcon_set_font().
>
> Link: https://syzkaller.appspot.com/bug?extid=25bdb7b1703639abd498 [1]
> Reported-by: syzbot <syzbot+25bdb7b1703639abd498@syzkaller.appspotmail.com>
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Tested-by: syzbot <syzbot+25bdb7b1703639abd498@syzkaller.appspotmail.com>
> Fixes: a5a923038d70 ("fbdev: fbcon: Properly revert changes when vc_resize() failed")

applied.
Thanks!

Helge

> ---
>   drivers/video/fbdev/core/fbcon.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 098b62f7b701..8363f3b2b452 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -2450,7 +2450,8 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount,
>
>   	if (userfont) {
>   		p->userfont = old_userfont;
> -		REFCOUNT(data)--;
> +		if (--REFCOUNT(data) == 0)
> +			kfree(data - FONT_EXTRA_WORDS * sizeof(int));
>   	}
>
>   	vc->vc_font.width = old_width;


      reply	other threads:[~2022-12-10 16:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05  4:34 [syzbot] memory leak in fbcon_set_font (2) syzbot
2022-12-05 22:10 ` [PATCH] fbdev: fbcon: release buffer when fbcon_do_set_font() failed Tetsuo Handa
2022-12-10 16:18   ` Helge Deller [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=8a045252-f169-6d61-9c52-860f8a9d0b00@gmx.de \
    --to=deller@gmx.de \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=syoshida@redhat.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.