mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: "Colin King (gmail)" <colin.i.king@gmail.com>,
	Calixte Pernot <calixte.pernot@grenoble-inp.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: vt: add support for smput/rmput escape codes
Date: Wed, 10 Sep 2025 08:41:31 +0200	[thread overview]
Message-ID: <51222649-6f41-4030-baaa-7b98b241de98@kernel.org> (raw)
In-Reply-To: <5002d4f9-4999-4a84-9329-edb20098fd7a@gmail.com>

On 09. 09. 25, 21:15, Colin King (gmail) wrote:
> Hi,
> 
> Static analysis on linux-next detected an issue with the following commit:
> 
> commit 23743ba64709a9c137c1b928f8b8e00d846af9cc
> Author: Calixte Pernot <calixte.pernot@grenoble-inp.org>
> Date:   Mon Aug 25 14:56:09 2025 +0200
> 
>      vt: add support for smput/rmput escape codes
> 
> 
> The issue is as follows in drivers/tty/vt/vt.c function vc_deallocate, 
> with my nodes prefixed by #####
> 
> struct vc_data *vc_deallocate(unsigned int currcons)
> {
...
>      ##### vc is potentially null and being dereferenced below:
> 
>          if (vc->vc_saved_screen != NULL) {
>                  kfree(vc->vc_saved_screen);
>                  vc->vc_saved_screen = NULL;
>          }
>          return vc;
> }
> 
> 
> The issue is that vc is only set in the if (vc_cons_allocated(currcons)) 
> if block, and when it is not set, we end up with a null pointer de- 
> reference on the if (vc->vc_saved_screen != NULL) check.
> 
> I suggest moving that latter check into the earlier if block.

Agreed:
https://lore.kernel.org/all/tencent_CAD45DB31906CF890DBB25AB0DED12205D07@qq.com/

thanks,
-- 
js
suse labs

      parent reply	other threads:[~2025-09-10  6:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09 19:15 Colin King (gmail)
2025-09-09 20:26 ` [PATCH v3] " Calixte Pernot
2025-09-10  6:43   ` Jiri Slaby
2025-09-10  7:10     ` Calixte Pernot
2025-09-10  6:41 ` Jiri Slaby [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=51222649-6f41-4030-baaa-7b98b241de98@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=calixte.pernot@grenoble-inp.org \
    --cc=colin.i.king@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®