diff options
| author | Aditya Pakki <pakki001@umn.edu> | 2019-03-18 18:50:56 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-03 06:27:33 +0200 |
| commit | e39ecf48678ee4a7445c68c17b0228b6d047a5c0 (patch) | |
| tree | 32828d561778c11c3480726b14210cddcb059365 /drivers/tty | |
| parent | 763eafe0dbf56e5ec2bbdf21c6106d37e6af9724 (diff) | |
| download | blackbird-obmc-linux-e39ecf48678ee4a7445c68c17b0228b6d047a5c0.tar.gz blackbird-obmc-linux-e39ecf48678ee4a7445c68c17b0228b6d047a5c0.zip | |
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')
| -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 231f751d1ef4..7e7b1559fa36 100644 --- a/drivers/tty/serial/mvebu-uart.c +++ b/drivers/tty/serial/mvebu-uart.c @@ -810,6 +810,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) |

