On Tue, 27 Oct 2026, Greg Kroah-Hartman wrote: > From: Joshua Rogers > > serial_get_or_create_irq_info() released hash_mutex before returning the > irq_info pointer, allowing serial_unlink_irq_chain() on another CPU to > free the irq_info before serial_link_irq_chain() could link its port, > causing a use-after-free. Hold hash_mutex in serial_link_irq_chain() for > its entire scope so the irq_info lifetime is protected across both > lookup and linking. > > Cc: stable > Cc: Jiri Slaby > Cc: John Ogness > Cc: Fushuai Wang > Cc: Crescent Hsieh > Cc: "Uwe Kleine-König (The Capable Hub)" > Signed-off-by: Joshua Rogers > Signed-off-by: Greg Kroah-Hartman > --- > drivers/tty/serial/8250/8250_core.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c > index 673fde55828a..5730ef97f836 100644 > --- a/drivers/tty/serial/8250/8250_core.c > +++ b/drivers/tty/serial/8250/8250_core.c > @@ -131,12 +131,11 @@ static void serial_do_unlink(struct irq_info *i, struct uart_8250_port *up) > * - find the corresponding info in the hashtable and return it, or > * - allocate a new one, add it to the hashtable and return it. > */ > +/* Caller must hold hash_mutex */ We do have lockdep asserts to actually check these. I also don't understand why own comment is opened for this. And it would be better to follow kerneldoc's syntax by starting with Context: > static struct irq_info *serial_get_or_create_irq_info(const struct uart_8250_port *up) > { > struct irq_info *i; > > - guard(mutex)(&hash_mutex); > - > hash_for_each_possible(irq_lists, i, node, up->port.irq) > if (i->irq == up->port.irq) > return i; > @@ -157,6 +156,8 @@ static int serial_link_irq_chain(struct uart_8250_port *up) > struct irq_info *i; > int ret; > > + guard(mutex)(&hash_mutex); > + > i = serial_get_or_create_irq_info(up); > if (IS_ERR(i)) > return PTR_ERR(i); > > -- i.