From: Greg KH <gregkh@linuxfoundation.org>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com,
johan@kernel.org, penguin-kernel@i-love.sakura.ne.jp,
zhangxuezhi1@coolpad.com, xyangxi5@gmail.com,
linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH] tty: vt: Add checks after calling kzalloc
Date: Wed, 31 Aug 2022 11:32:43 +0200 [thread overview]
Message-ID: <Yw8qu1op37fWTvdi@kroah.com> (raw)
In-Reply-To: <20220831090810.2175859-1-jiasheng@iscas.ac.cn>
On Wed, Aug 31, 2022 at 05:08:10PM +0800, Jiasheng Jiang wrote:
> On Wed, Aug 31, 2022 at 03:57:42PM +0800, Jiasheng Jiang wrote:
> >> for (currcons = 0; currcons < MIN_NR_CONSOLES; currcons++) {
> >> vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT);
> >> + if (!vc) {
> >> + console_unlock();
> >> + return -ENOMEM;
> >> + }
> >> INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
> >> tty_port_init(&vc->port);
> >> visual_init(vc, currcons, 1);
> >> /* Assuming vc->vc_{cols,rows,screenbuf_size} are sane here. */
> >> vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT);
> >> + if (!vc->vc_screenbuf) {
> >> + console_unlock();
> >> + return -ENOMEM;
> >> + }
> >
> > This has been attempted many times in the past, sorry. Unless you can
> > prove that this can actually happen in real life, we are going to leave
> > these as-is.
> >
> > Please do not just do random changes like this without actually testing
> > to see if it is possible to happen.
>
> As the harm of vulnerabilities is much higher than the cost of fixing them,
> it is acceptable to add harmless security checks that guarantee the
> vulnerabilities will never be triggered.
No, not always, many times you are adding new bugs by doing this type of
"unneeded fixes". We have had this happen in the vt code many times in
the past, let's learn from our mistakes please.
And where is the "vulnerability" here exactly?
thanks,
greg k-h
next prev parent reply other threads:[~2022-08-31 9:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-31 9:08 Re: [PATCH] tty: vt: Add checks after calling kzalloc Jiasheng Jiang
2022-08-31 9:32 ` Greg KH [this message]
2022-08-31 9:42 ` Tetsuo Handa
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=Yw8qu1op37fWTvdi@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jiasheng@iscas.ac.cn \
--cc=jirislaby@kernel.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=xyangxi5@gmail.com \
--cc=zhangxuezhi1@coolpad.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox