diff options
author | Aditya Pakki <pakki001@umn.edu> | 2019-03-19 02:50:56 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-03 07:26:25 +0300 |
commit | b1e660c6f8026d52a54ea64288be4a3726fc3394 (patch) | |
tree | d759afbf1c0e22351e4ffe6dbdaddb0515125723 /drivers/tty/serial/mvebu-uart.c | |
parent | f34ec64b3f6cc2ae83da6901430be0204297f2d4 (diff) | |
download | linux-b1e660c6f8026d52a54ea64288be4a3726fc3394.tar.xz |
serial: mvebu-uart: Fix to avoid a potential NULL pointer dereference
commit 32f47179833b63de72427131169809065db6745e upstream.
of_match_device on failure to find a matching device can return a NULL
pointer. The patch checks for such a scenrio and passes the error upstream.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/mvebu-uart.c')
-rw-r--r-- | drivers/tty/serial/mvebu-uart.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c index 170e446a2f62..7d26c9b57d8e 100644 --- a/drivers/tty/serial/mvebu-uart.c +++ b/drivers/tty/serial/mvebu-uart.c @@ -799,6 +799,9 @@ static int mvebu_uart_probe(struct platform_device *pdev) return -EINVAL; } + if (!match) + return -ENODEV; + /* Assume that all UART ports have a DT alias or none has */ id = of_alias_get_id(pdev->dev.of_node, "serial"); if (!pdev->dev.of_node || id < 0) |