All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Igor Putko <igorpetindev@gmail.com>
Cc: Jiri Slaby <jirislaby@kernel.org>, Rob Herring <robh@kernel.org>,
	Vignesh R <vigneshr@ti.com>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+843bf2f48f4d12e6682e@syzkaller.appspotmail.com
Subject: Re: [PATCH] serial: core: shut down initialized port on removal
Date: Fri, 25 Sep 2026 07:34:24 +0200	[thread overview]
Message-ID: <2026092502-staple-surgery-df48@gregkh> (raw)
In-Reply-To: <20260924192224.3175-1-igorpetindev@gmail.com>

On Thu, Sep 24, 2026 at 10:22:24PM +0300, Igor Putko wrote:
> When a serial port configured as a console is opened and subsequently
> closed, tty_port_shutdown() skips invoking port->ops->shutdown() because
> port->console is true. As a result, tty_port_initialized() remains true
> and the port's interrupt handler stays registered in the irq subsystem.
> 
> If the underlying device is later unbound or removed (e.g. via sysfs
> unbind), serial_core_remove_one_port() unregisters the console, frees
> uport->name with kfree(), and clears state->uart_port without ever
> shutting down the port or freeing its IRQ. Consequently, the irqaction
> remains linked in the genirq descriptor with action->name pointing to
> freed memory.
> 
> When another device later requests the same IRQ line, __setup_irq()
> encounters the stale action, detects a flags mismatch, and attempts to
> print old->name in pr_err(), triggering a KASAN use-after-free read:

How can a different device request the same irq line on a real device?

How was this all tested, with "fake" devices?

thanks,

greg k-h

  parent reply	other threads:[~2026-09-25  5:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 19:22 [PATCH] serial: core: shut down initialized port on removal Igor Putko
2026-09-24 19:39 ` sashiko-bot
2026-09-25  5:34 ` Greg Kroah-Hartman [this message]
2026-09-26 13:05 ` IgorpetinDev
2026-10-01  8:58   ` Greg KH
2026-10-03 16:33 ` [PATCH v2] " Igor Putko
2026-10-03 17:56   ` sashiko-bot
2026-10-13 16:45   ` Phil Rosenthal

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=2026092502-staple-surgery-df48@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=igorpetindev@gmail.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=syzbot+843bf2f48f4d12e6682e@syzkaller.appspotmail.com \
    --cc=vigneshr@ti.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 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.