[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210814091750.73931-2-mailhol.vincent@wanadoo.fr>
Date: Sat, 14 Aug 2021 18:17:44 +0900
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
To: Marc Kleine-Budde <mkl@...gutronix.de>, linux-can@...r.kernel.org
Cc: Stefan Mätje <Stefan.Maetje@....eu>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Vincent Mailhol <mailhol.vincent@...adoo.fr>
Subject: [PATCH v4 1/7] can: netlink: allow user to turn off unsupported features
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 <mailhol.vincent@...adoo.fr>
---
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
Powered by blists - more mailing lists