Commit 488ba7c5 authored by Oliver Hartkopp's avatar Oliver Hartkopp Committed by Sasha Levin

can: fix handling of unmodifiable configuration options fix

[ Upstream commit bce271f2 ]

With upstream commit bb208f14 (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: default avatarajneu <ajneu1@gmail.com>
Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent f3d1ae6f
...@@ -798,6 +798,9 @@ static int can_validate(struct nlattr *tb[], struct nlattr *data[]) ...@@ -798,6 +798,9 @@ static int can_validate(struct nlattr *tb[], struct nlattr *data[])
* - control mode with CAN_CTRLMODE_FD set * - control mode with CAN_CTRLMODE_FD set
*/ */
if (!data)
return 0;
if (data[IFLA_CAN_CTRLMODE]) { if (data[IFLA_CAN_CTRLMODE]) {
struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]); struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment