From: Greg KH <greg@kroah.com>
To: Dongyang Zhan <zdyzztq@gmail.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: Fwd: Possible null pointer dereference in con_init()
Date: Sun, 3 May 2020 09:44:20 +0200 [thread overview]
Message-ID: <20200503074420.GA536697@kroah.com> (raw)
In-Reply-To: <CAFSR4ctg3xM_Z+oqVWjA9+hy+Cc33FfVqa5LgFAEkgUO1RxX1A@mail.gmail.com>
On Sun, May 03, 2020 at 03:20:50PM +0800, Dongyang Zhan wrote:
> Hi,
>
> I am a security researcher, my name is Dongyang Zhan. I found a potential bug.
>
> I hope you can help me to confirm it.
>
> Thank you.
>
> In Linux 4.10.17, function con_init() in /drivers/tty/vt/vt.c forgets
> to handle the failure of the memory allocation operation (e.g.,
> vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data),
> GFP_NOWAIT)).
>
> Source code and comments;
> vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT);
> INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
> tty_port_init(&vc->port);
> visual_init(vc, currcons, 1);
> vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT);
> vc_init(vc, vc->vc_rows, vc->vc_cols,
> currcons || !vc->vc_sw->con_save_screen);
>
> If the allocation fails, dereferencing vc will cause a null pointer dereference.
But that allocation can not fail, so all is fine.
thanks,
greg k-h
prev parent reply other threads:[~2020-05-03 7:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAFSR4cs_pVwH1Tcf4-pyKr3-TPtvS34Av-2jGA7L4MmTX-_4rw@mail.gmail.com>
2020-05-03 7:20 ` Fwd: Possible null pointer dereference in con_init() Dongyang Zhan
2020-05-03 7:44 ` Greg KH [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=20200503074420.GA536697@kroah.com \
--to=greg@kroah.com \
--cc=linux-serial@vger.kernel.org \
--cc=zdyzztq@gmail.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.