Commit 9a003012 authored by Stephen Warren's avatar Stephen Warren Committed by Khalid Elmously

usb: gadget: serial: fix oops when data rx'd after close

BugLink: https://bugs.launchpad.net/bugs/1801900

commit daa35bd9 upstream.

When the gadget serial device has no associated TTY, do not pass any
received data into the TTY layer for processing; simply drop it instead.
This prevents the TTY layer from calling back into the gadget serial
driver, which will then crash in e.g. gs_write_room() due to lack of
gadget serial device to TTY association (i.e. a NULL pointer dereference).
Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent ac2ed134
......@@ -518,7 +518,7 @@ static void gs_rx_push(unsigned long _port)
}
/* push data to (open) tty */
if (req->actual) {
if (req->actual && tty) {
char *packet = req->buf;
unsigned size = req->actual;
unsigned n;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment