Linux Serial subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Haoli Zhang" <26031212468@stu.xidian.edu.cn>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH] tty: vt: protect tty lifetime in keyboard path
Date: Tue, 17 Nov 2026 09:23:34 +0000	[thread overview]
Message-ID: <sashiko-outbox-218476@kernel.org> (raw)
In-Reply-To: <20261117091207.3950936-1-26031212468@stu.xidian.edu.cn>

> The KASAN report reaches stop_tty() through fn_hold(). That handler
> reads vc->port.tty and uses it without holding a tty reference. It runs
> under kbd_event_lock, while con_shutdown() clears the port association
> under console_lock; these locks do not protect the tty lifetime.
> 
> Use the tty_port_tty guard in fn_hold() and keep the reference until
> start_tty() or stop_tty() returns. Keep kbd_keycode()'s existing tty
> reference interval unchanged.
> 
> Use tty_port_tty_set() when installing and clearing the association so
> that updates use the same port lock as guarded reads and the port holds a
> tty reference while the association is active. A keyboard operation
> that already obtained a reference can then finish safely after shutdown
> clears the association.
> 
> Reported-by: syzbot+2932e8970a6398db95c3@syzkaller.appspotmail.com
> Closes: https://syzbot.org/bug?extid=2932e8970a6398db95c3
> Co-developed-by: Jinning Zhang <25031212117@stu.xidian.edu.cn>
> Signed-off-by: Jinning Zhang <25031212117@stu.xidian.edu.cn>
> Co-developed-by: Bin Yu <byu@xidian.edu.cn>
> Signed-off-by: Bin Yu <byu@xidian.edu.cn>
> Signed-off-by: Haoli Zhang <26031212468@stu.xidian.edu.cn>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117091207.3950936-1-26031212468@stu.xidian.edu.cn?part=1


      reply	other threads:[~2026-11-17  9:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  9:12 [PATCH] tty: vt: protect tty lifetime in keyboard path Haoli Zhang
2026-11-17  9:23 ` sashiko-bot [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=sashiko-outbox-218476@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=26031212468@stu.xidian.edu.cn \
    --cc=linux-serial@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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