]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
can: netlink: avoid call to do_set_data_bittiming callback with stale can_priv::ctrlmode
authorStefan Mätje <stefan.maetje@esd.eu>
Thu, 8 Aug 2024 16:42:24 +0000 (18:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Oct 2024 10:00:20 +0000 (12:00 +0200)
commit27129511a0ee5b605768c5923117f0181fec2317
tree3dbc5facf667e5cd8a2b7befae3c06b5192285ab
parent95425df8814f9864dc03cb66504048a85a525a5f
can: netlink: avoid call to do_set_data_bittiming callback with stale can_priv::ctrlmode

[ Upstream commit 2423cc20087ae9a7b7af575aa62304ef67cad7b6 ]

This patch moves the evaluation of data[IFLA_CAN_CTRLMODE] in function
can_changelink in front of the evaluation of data[IFLA_CAN_BITTIMING].

This avoids a call to do_set_data_bittiming providing a stale
can_priv::ctrlmode with a CAN_CTRLMODE_FD flag not matching the
requested state when switching between a CAN Classic and CAN-FD bitrate.

In the same manner the evaluation of data[IFLA_CAN_CTRLMODE] in function
can_validate is also moved in front of the evaluation of
data[IFLA_CAN_BITTIMING].

This is a preparation for patches where the nominal and data bittiming
may have interdependencies on the driver side depending on the
CAN_CTRLMODE_FD flag state.

Signed-off-by: Stefan Mätje <stefan.maetje@esd.eu>
Link: https://patch.msgid.link/20240808164224.213522-1-stefan.maetje@esd.eu
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/can/dev/netlink.c