Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp686076pxy; Sat, 14 Aug 2021 20:35:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyB1tFyC6hL/fpOEycrrOX0gSZaoElKXaGBKUzHuiXER5+q7q9zTWtVDYSx39Ss+gg3grmw X-Received: by 2002:a05:6402:2928:: with SMTP id ee40mr9605848edb.191.1628998534706; Sat, 14 Aug 2021 20:35:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628998534; cv=none; d=google.com; s=arc-20160816; b=EeIFm1IXyN3hT4nGBU8+oeCPHYwbsBuOPFN05tcfn5xTgva83F6CcYd85JA73BLUCP 41WNwGeY71bUaheNNlN66zd5ks1NEb1o4TwiSbbFtvfZTbwzoITxJlRxgMJDsdroXWHv ZvC8C5wrKzTM97SBFqLfVQKNHeerNn5b4ajCFgJIsPWHgAVNPoZF08KsKYCVCtTL5CRE uI/iCLLQglNUG/W+lnQQW1w+2EfbUyv/fanJnDmAKv9YxFQCUgUi+qC0AIpodXpJN/JC r+e1Wft5jOhUcBJfukFTaiIzDZ3TZVAWBHSS9KK/V+Aab9YiriNSUlAA2i8ufTNWwOFQ V73g== 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=NMutkXEylxEqkX5e32oT5OoZ18SqIqVd8n0AZK2euI+UwqaFF4x4E4YC5nyC6gmAto JBbcDkygAiCr7Csekd3RjohtKdQxRKuoew7tXeQfAVGAoZO7C4PEhc9YWDODf+RLHi5W C6YlelHNgjwDrsDruXAdatJkDRmEw3gMQAwLmR0Kg7v9Vkg8qQjWpY6YlTk9mmIjNI4f Xa06j7zAFxT9khTOA/fmrbOu19HYsTkVUywml3YsVhBuYjH2osNPZc+nnzEs2sZ14Ka2 gf4I61KCUce43JeHYzhfHsqWUZeR+x2UeNw3DGiSBCCjD/650yHH+c/ZGX+SMwf6PYvd Mipg== 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 h15si6669637eds.513.2021.08.14.20.35.12; Sat, 14 Aug 2021 20:35:34 -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 S235915AbhHODeC (ORCPT + 99 others); Sat, 14 Aug 2021 23:34:02 -0400 Received: from smtp11.smtpout.orange.fr ([80.12.242.133]:56794 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235780AbhHODd6 (ORCPT ); Sat, 14 Aug 2021 23:33:58 -0400 Received: from tomoyo.flets-east.jp ([114.149.34.46]) by mwinf5d21 with ME id hfZ7250050zjR6y03fZRx8; Sun, 15 Aug 2021 05:33:28 +0200 X-ME-Helo: tomoyo.flets-east.jp X-ME-Auth: bWFpbGhvbC52aW5jZW50QHdhbmFkb28uZnI= X-ME-Date: Sun, 15 Aug 2021 05:33:28 +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 v5 1/7] can: netlink: allow user to turn off unsupported features Date: Sun, 15 Aug 2021 12:32:42 +0900 Message-Id: <20210815033248.98111-2-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210815033248.98111-1-mailhol.vincent@wanadoo.fr> References: <20210815033248.98111-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