]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
can: fix handling of unmodifiable configuration options fix
authorOliver Hartkopp <socketcan@hartkopp.net>
Tue, 21 Jun 2016 10:14:07 +0000 (12:14 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 23 Jun 2016 08:58:16 +0000 (10:58 +0200)
With upstream commit bb208f144cf3f59 (can: fix handling of unmodifiable
configuration options) a new can_validate() function was introduced.

When invoking 'ip link set can0 type can' without any configuration data
can_validate() tries to validate the content without taking into account that
there's totally no content. This patch adds a check for missing content.

Reported-by: ajneu <ajneu1@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/dev.c

index 910c12e2638e3615084ca9f6a148030c8f2358e1..348dd5001fa48914765e0725d64e71f6d8686737 100644 (file)
@@ -798,6 +798,9 @@ static int can_validate(struct nlattr *tb[], struct nlattr *data[])
         * - control mode with CAN_CTRLMODE_FD set
         */
 
+       if (!data)
+               return 0;
+
        if (data[IFLA_CAN_CTRLMODE]) {
                struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]);