Re: [linus:master] [serial] 43066e3222: BUG:kernel_NULL_pointer_dereference,address

From: Andy Shevchenko
Date: Wed Apr 03 2024 - 10:01:00 EST


On Wed, Apr 03, 2024 at 09:43:28PM +0800, kernel test robot wrote:

> kernel test robot noticed "BUG:kernel_NULL_pointer_dereference,address" on:
>
> commit: 43066e32227ecde674e8ae1fcdd4a1ede67680c2 ("serial: port: Don't suspend if the port is still busy")
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master

Ja-ja, I am investigating this issue for a while (not that I spend all my time
on it, though) on max3100.

The problem seems that we enable PM runtime on all serial ports
(even if they have no RPM support), but at the same time we enforce
the common serial_port PM callbacks and that change misses a detail
on how to check the port status as the real callback may happen
quite after the port being closed (/dev/ttySx).

Probably we need to check if the port is still open...

P.S. AFAIU the state / xmit is invalid pointer or so.

Culprit line: serial_out(up, UART_TX, xmit->buf[xmit->tail]);

--
With Best Regards,
Andy Shevchenko