usb: gadget: u_serial: Add null pointer check in gs_start_io
authorKuen-Han Tsai <khtsai@google.com>
Fri, 2 Jun 2023 07:00:06 +0000 (15:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Jun 2023 09:55:09 +0000 (11:55 +0200)
commitffd603f214237e250271162a5b325c6199a65382
tree8fc707c8dccfecaed01e094af1e5a3ed6c85dc8e
parent0a453dc9f260281e3a063e07b526a7e494e496fe
usb: gadget: u_serial: Add null pointer check in gs_start_io

If gs_close has cleared port->port.tty and gs_start_io is called
afterwards, then the function tty_wakeup will attempt to access the value
of the pointer port->port.tty which will cause a null pointer
dereference error.

To avoid this, add a null pointer check to gs_start_io before attempting
to access the value of the pointer port->port.tty.

Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
Message-ID: <20230602070009.1353946-1-khtsai@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/u_serial.c