All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Johan Hovold" <johan@kernel.org>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v2] serial: core: fix use-after-free after driver module unload
Date: Thu, 12 Nov 2026 14:31:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-211328@kernel.org> (raw)
In-Reply-To: <20261112142209.454331-1-johan@kernel.org>

> Deregistering a uart driver frees the driver uart state including the
> tty ports themselves.
> 
> Restore the uart driver module as owner of the tty driver so that the
> uart state and resources like the tty driver name do not go away while a
> tty is still open.
> 
> This specifically avoids use-after-free when accessing the tty port and
> crashes when accessing the tty driver name (e.g. in the tty printk
> macros) when a tty is closed after its driver module has been unloaded.
> 
> It also makes sure that the uart state is still valid when waking up any
> waiters after releasing the final uart port reference in
> uart_port_deref().
> 
> Note that a few drivers deregister their uart drivers also when a
> (platform) device is manually unbound through sysfs (but if you use that
> interface, you get to keep the pieces).
> 
> Fixes: 2f16669d322e ("TTY: remove re-assignments to tty_driver members")
> Cc: stable@vger.kernel.org	# 3.4
> Cc: Jiri Slaby <jirislaby@kernel.org>
> Signed-off-by: Johan Hovold <johan@kernel.org>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112142209.454331-1-johan@kernel.org?part=1


      reply	other threads:[~2026-11-12 14:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 14:22 [PATCH v2] serial: core: fix use-after-free after driver module unload Johan Hovold
2026-11-12 14:31 ` 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-211328@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=johan@kernel.org \
    --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 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.