From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Calixte Pernot <calixte.pernot@grenoble-inp.org>,
Jiri Slaby <jirislaby@kernel.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: Tue, 9 Sep 2025 20:15:33 +0100 [thread overview]
Message-ID: <5002d4f9-4999-4a84-9329-edb20098fd7a@gmail.com> (raw)
[-- Attachment #1.1.1: Type: text/plain, Size: 1679 bytes --]
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)
{
struct vc_data *vc = NULL; #### vc is set to null
WARN_CONSOLE_UNLOCKED();
if (vc_cons_allocated(currcons)) {
struct vt_notifier_param param;
##### vs is only set in this if block
param.vc = vc = vc_cons[currcons].d;
atomic_notifier_call_chain(&vt_notifier_list,
VT_DEALLOCATE, ¶m);
vcs_remove_sysfs(currcons);
visual_deinit(vc);
con_free_unimap(vc);
put_pid(vc->vt_pid);
vc_uniscr_set(vc, NULL);
kfree(vc->vc_screenbuf);
vc_cons[currcons].d = NULL;
}
##### 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.
Colin
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 4901 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
next reply other threads:[~2025-09-09 19:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-09 19:15 Colin King (gmail) [this message]
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
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=5002d4f9-4999-4a84-9329-edb20098fd7a@gmail.com \
--to=colin.i.king@gmail.com \
--cc=calixte.pernot@grenoble-inp.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.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®