um: vector: Avoid NULL ptr deference if transport is unset
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Sun, 16 Feb 2020 21:36:24 +0000 (22:36 +0100)
committerRichard Weinberger <richard@nod.at>
Sun, 29 Mar 2020 21:54:51 +0000 (23:54 +0200)
When the transport option of a vec isn't set strncmp ends up being
called on a NULL pointer. Better not do that.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
arch/um/drivers/vector_kern.c

index 9693dfca765138cf828eab770365f35e15b7e4bd..8e8aac1d30e13d957d866497af3238ab44b813f3 100644 (file)
@@ -197,6 +197,9 @@ static int get_transport_options(struct arglist *def)
        long parsed;
        int result = 0;
 
+       if (transport == NULL)
+               return -EINVAL;
+
        if (vector != NULL) {
                if (kstrtoul(vector, 10, &parsed) == 0) {
                        if (parsed == 0) {