RE: [PATCH] printk: nbcon: check uart port is nbcon or not in nbcon_release

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024-01-17, "Chang, Junxiao" <junxiao.chang@xxxxxxxxx> wrote:
> As you mentioned, same console driver is only registered once. 8250
> console driver is registered once, its "struct console *newcon"
> parameter is address of "univ8250_console" which is defined in
> drivers\tty\serial\8250\8250_core.c.
>
> However, in each serial port device is registered, their cons pointer(
> "struct console *cons;" in "struct uart_port") will be assigned with
> same cons in API serial_core_add_one_port:
>
> 	uport->cons = drv->cons;
>
> That is, multiple similar 8250 uart_port devices have same console
> pointer which points to above univ8250_console.

Ah. This explains the "(port)->cons->index == (port)->line" check in
uart_console(). Thank you for clarifying.

> BTW, this issue couldn't be reproduced with v6.6.7-rt17 kernel.

The reason for the change is because console registration/unregistration
is not related to the port lock. There is a potential race condition if
nbcon unlocking is based on the UART port still being registered as a
console.

We could move the @locked_port flag to the struct uart_port. (Probably
renaming it to @nbcon_locked_port.) I think that would be the
appropriate fix.

John




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux