Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp123991pxy; Sat, 14 Aug 2021 02:20:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwj6WLLvD6N/Pfn73zzJwMiwqp5YM/pn3F22kQP3B0pVK+1PJVkwWSiaWsOIW53Xlcy63u8 X-Received: by 2002:a92:cf4a:: with SMTP id c10mr4816033ilr.269.1628932829853; Sat, 14 Aug 2021 02:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628932829; cv=none; d=google.com; s=arc-20160816; b=heORTFdi6ZReZGYnWxOgV414LH54wed4UTfkctn8pLgDIFNpBwjrQUG64oVEMzZkPe D9WwjnqVsqxwOaj4CHRH6YKEbOSY3PkoLdei1NnH+P+zavmQMtB5PuvvogBN3B28I9Bd MD/5wnskU2ZsipdZhcys9CMJ6iVBbCnNNh30sRZ6RPznQCctumBUqLliCBNCp55AcKqW XR5mmSdn0KU77cnqk4YbAyZCjz8GL/LbH7ABGpBVbXY7DUgOzYoMAsjjlnFYbGwlVRb3 1jWH84l1X0tqeO0xOZ/vIZ3klSq/UuEdGg9BIaglgo3v9IQXQz6+/fKbYEymKhoPDLyY j/sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=9WvINPTKQmi/dizMBxcAezIrj2DqUufa29f1YqZbAHM=; b=QNcWVIRbwL7Af1zjJxJiTCOntbVtmquOhLbNH6tUAlrFrbUu9aqKKAj2tMQ6k8RPoD E89OznICRyvSaeorcEfrQ0wiuTMFyroGVuyFMmEMLXpG78j8YIbQ+0N4DINTTc/PhaHR P4+Bk1RLCXRlv06TTNW0g75+TIf2TwAs8Arpb2jBvSrKEobJLt6u9mt9RRAK2m7mH0X2 478tAefdDYz4u6m+/kkSwwm5Ett1iz7eYhUpFgR9IwsUL5VHZnudaxeJnrcfaHsYpTcY 0QR+abzOwMUnkYJvxDnG30yFIYVT83JtMEM277ANyPH0Cd1lxI/qYSfj0u5mJc/msJi6 /H7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u6si4310728ilq.19.2021.08.14.02.20.19; Sat, 14 Aug 2021 02:20:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237697AbhHNJT4 (ORCPT + 99 others); Sat, 14 Aug 2021 05:19:56 -0400 Received: from smtp03.smtpout.orange.fr ([80.12.242.125]:21475 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237700AbhHNJTv (ORCPT ); Sat, 14 Aug 2021 05:19:51 -0400 Received: from tomoyo.flets-east.jp ([114.149.34.46]) by mwinf5d19 with ME id hMJz250060zjR6y03MKLjg; Sat, 14 Aug 2021 11:19:22 +0200 X-ME-Helo: tomoyo.flets-east.jp X-ME-Auth: bWFpbGhvbC52aW5jZW50QHdhbmFkb28uZnI= X-ME-Date: Sat, 14 Aug 2021 11:19:22 +0200 X-ME-IP: 114.149.34.46 From: Vincent Mailhol To: Marc Kleine-Budde , linux-can@vger.kernel.org Cc: =?UTF-8?q?Stefan=20M=C3=A4tje?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Mailhol Subject: [PATCH v4 1/7] can: netlink: allow user to turn off unsupported features Date: Sat, 14 Aug 2021 18:17:44 +0900 Message-Id: <20210814091750.73931-2-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210814091750.73931-1-mailhol.vincent@wanadoo.fr> References: <20210814091750.73931-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The sanity checks on the control modes will reject any request related to an unsupported features, even turning it off. Example on an interface which does not support CAN-FD: $ ip link set can0 type can bitrate 500000 fd off RTNETLINK answers: Operation not supported This patch lets such command go through (but requests to turn on an unsupported feature are, of course, still denied). Signed-off-by: Vincent Mailhol --- drivers/net/can/dev/netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/dev/netlink.c b/drivers/net/can/dev/netlink.c index 147c23d7dab7..80425636049d 100644 --- a/drivers/net/can/dev/netlink.c +++ b/drivers/net/can/dev/netlink.c @@ -116,7 +116,7 @@ static int can_changelink(struct net_device *dev, struct nlattr *tb[], maskedflags = cm->flags & cm->mask; /* check whether provided bits are allowed to be passed */ - if (cm->mask & ~(priv->ctrlmode_supported | ctrlstatic)) + if (maskedflags & ~(priv->ctrlmode_supported | ctrlstatic)) return -EOPNOTSUPP; /* do not check for static fd-non-iso if 'fd' is disabled */ -- 2.31.1