From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:60568 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753973AbcHRMt6 (ORCPT ); Thu, 18 Aug 2016 08:49:58 -0400 From: Jiri Slaby To: stable@vger.kernel.org Cc: Oliver Hartkopp , Marc Kleine-Budde , Jiri Slaby Subject: [patch added to 3.12-stable] can: fix handling of unmodifiable configuration options fix Date: Thu, 18 Aug 2016 14:49:08 +0200 Message-Id: <20160818124953.31969-3-jslaby@suse.cz> In-Reply-To: <20160818124953.31969-1-jslaby@suse.cz> References: <20160818124953.31969-1-jslaby@suse.cz> Sender: stable-owner@vger.kernel.org List-ID: From: Oliver Hartkopp This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. =============== 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 Signed-off-by: Oliver Hartkopp Signed-off-by: Marc Kleine-Budde Signed-off-by: Jiri Slaby --- drivers/net/can/dev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index f66aeb79abdf..3c1a7f8211be 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c @@ -644,6 +644,9 @@ static int can_changelink(struct net_device *dev, /* We need synchronization with dev->stop() */ ASSERT_RTNL(); + if (!data) + return 0; + if (data[IFLA_CAN_CTRLMODE]) { struct can_ctrlmode *cm; -- 2.9.3