8250_men_mcb: port.dev unset can entail a null ptr deref
PATCH 1/1 8250_men_mcb: port.dev unset can entail a null ptr deref
The dev field of the uart_port structure is needed in the later call to serial8250_register_8250_port and unless the port is part of the initial registered ports (cf. CONFIG_SERIAL_8250_RUNTIME_UARTS) with a dev already set, it will make a null pointer deref in has_acpi_companion and could also later at uart_add_one_port call:
Oops: general protection fault, probably for non-canonical address KASAN: null-ptr-deref in range RIP: 0010:serial8250_register_8250_port+0xd34/0x2030
drivers/tty/serial/8250/8250_core.c
A proposal for a security check against this missing field in any driver for the 8250_core.c will be sent in another patch.
--- drivers/tty/serial/8250/8250_men_mcb.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/8250/8250_men_mcb.c +1 -0
@@ -214,6 +214,7 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev, uart.port.iotype =UPIO_MEM ; uart.port.uartclk =men_lookup_uartclk (mdev); uart.port.irq =mcb_get_irq (mdev); + uart.port.dev = &mdev->dev; uart.port.mapbase = (unsigned long ) mem->start + data->offset[i];
Signature · 1 line
2.34.1
Greg KH
maintainerQuoted 35 lines · Filip Jensen
The dev field of the
uart_portstructure is needed in the later call toserial8250_register_8250_portand unless the port is part of the initial registered ports (cf.CONFIG_SERIAL_8250_RUNTIME_UARTS) with a dev already set, it will make a null pointer deref inhas_acpi_companionand could also later atuart_add_one_portcall:Oops: general protection fault, probably for non-canonical address KASAN: null-ptr-deref in range RIP: 0010:serial8250_register_8250_port+0xd34/0x2030
drivers/tty/serial/8250/8250_core.cA proposal for a security check against this missing field in any driver for the
8250_core.cwill be sent in another patch.Signed-off-by Filip Jensen <[email protected]>--- drivers/tty/serial/8250/8250_men_mcb.c | 1 + 1 file changed, 1 insertion(+)drivers/tty/serial/8250/8250_men_mcb.c +1
-0@@ -214,6 +214,7 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev, uart.port.iotype =UPIO_MEM ; uart.port.uartclk =men_lookup_uartclk (mdev); uart.port.irq =mcb_get_irq (mdev); + uart.port.dev = &mdev->dev; uart.port.mapbase = (unsigned long ) mem->start + data->offset[i];Signature · 1 line
2.34.1
What changed to require this patch? And can you fix up the same issues that Jiri pointed out in your other patch like this?
thanks,
greg k-h