Skip to content

Commit 8648445

Browse files
hartkoppgregkh
authored andcommitted
can: fix handling of unmodifiable configuration options fix
commit bce271f255dae8335dc4d2ee2c4531e09cc67f5a upstream. 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> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1cee72e commit 8648445

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/net/can/dev.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,9 @@ static int can_validate(struct nlattr *tb[], struct nlattr *data[])
798798
* - control mode with CAN_CTRLMODE_FD set
799799
*/
800800

801+
if (!data)
802+
return 0;
803+
801804
if (data[IFLA_CAN_CTRLMODE]) {
802805
struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]);
803806

0 commit comments

Comments
 (0)