FAILED: patch "[PATCH] can: dev: can_fill_info(): don't wake up controller if interface is down" failed to apply to 5.10-stable tree
Subsystems (2)
Sasha Levin
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 75332c410c8190d61499001c5516af977ca426c3
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 75332c410c8190d61499001c5516af977ca426c3 Mon Sep 17 00:00:00 2001
From: ChunYuZhiQiang <[email protected]>
Date: Tue, 27 Oct 2026 14:50:11 +0800
Subject: [PATCH] can: dev: can_fill_info(): don't wake up controller if
interface is down
If the interface is down, the CAN controller might be powered down and its clocks gated. Don't call do_get_berr_counter() to read the bus error counters if the interface is down, and adjust can_get_size() to match.
This removes one trigger for a synchronous external abort seen on i.MX8QXP when "ip link show" is run on a flexcan interface that was never brought up. The underlying cause is platform-specific: on i.MX8QXP the CAN clocks are gated through the SCU LPCG and the subsystem shares the IMX_SC_R_CAN_0 power domain, and there is a window after pm_runtime_resume_and_get() returns where the clock has not reached the module yet. This patch avoids the netlink query path while the interface is down, but does not root-cause the LPCG window itself.
As a result, IFLA_CAN_BERR_COUNTER is no longer reported for down interfaces. Userspace must treat the attribute as optional.
The issue was triggered on an i.MX8QXP board by running "ip link show" without ever bringing the interface up:
Internal error: synchronous external abort: 0000000096000210
pc : flexcan_read_le+0x0/0x18
lr : flexcan_get_berr_counter+0x4c/0x8c
Call trace:
flexcan_read_le+0x0/0x18
flexcan_get_berr_counter+0x4c/0x8c
can_fill_info+0x1f8/0x434
rtnl_fill_ifinfo+0x8fc/0xbb4
rtnl_dump_ifinfo+0x364/0x448This is the same class of problem fixed for m_can in commit 91a55c72a821 ("can: m_can: m_can_get_berr_counter(): don't wake up controller if interface is down").
--- drivers/net/can/dev/netlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/dev/netlink.c +2 -2
@@ -812,7 +812,7 @@ static size_t can_get_size(const struct net_device *dev) size +=nla_total_size (sizeof (u32));/* IFLA_CAN_STATE */ size +=nla_total_size (sizeof (struct can_ctrlmode ));/* IFLA_CAN_CTRLMODE */ size +=nla_total_size (sizeof (u32));/* IFLA_CAN_RESTART_MS */ -if (priv->do_get_berr_counter)/* IFLA_CAN_BERR_COUNTER */ +if (priv->do_get_berr_counter &&netif_running (dev))/* IFLA_CAN_BERR_COUNTER */ size +=nla_total_size (sizeof (struct can_berr_counter ));if (priv->termination_const) { size +=nla_total_size (sizeof (priv->termination));/* IFLA_CAN_TERMINATION */
@@ -1006,7 +1006,7 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev)nla_put (skb,IFLA_CAN_CTRLMODE ,sizeof (cm), &cm) ||nla_put_u32 (skb,IFLA_CAN_RESTART_MS , priv->restart_ms) || - (priv->do_get_berr_counter && + (priv->do_get_berr_counter &&netif_running (dev) && !priv->do_get_berr_counter (dev, &bec) && nla_put(skb, IFLA_CAN_BERR_COUNTER, sizeof(bec), &bec)) ||
Signature · 1 line
2.53.0
PATCH 1/1 can: dev: can_fill_info(): don't wake up controller if interface is down
commit 75332c410c8190d61499001c5516af977ca426c3 upstream.
If the interface is down, the CAN controller might be powered down and its clocks gated. Don't call do_get_berr_counter() to read the bus error counters if the interface is down, and adjust can_get_size() to match.
This removes one trigger for a synchronous external abort seen on i.MX8QXP when "ip link show" is run on a flexcan interface that was never brought up. The underlying cause is platform-specific: on i.MX8QXP the CAN clocks are gated through the SCU LPCG and the subsystem shares the IMX_SC_R_CAN_0 power domain, and there is a window after pm_runtime_resume_and_get() returns where the clock has not reached the module yet. This patch avoids the netlink query path while the interface is down, but does not root-cause the LPCG window itself.
As a result, IFLA_CAN_BERR_COUNTER is no longer reported for down interfaces. Userspace must treat the attribute as optional.
The issue was triggered on an i.MX8QXP board by running "ip link show" without ever bringing the interface up:
Internal error: synchronous external abort: 0000000096000210
pc : flexcan_read_le+0x0/0x18
lr : flexcan_get_berr_counter+0x4c/0x8c
Call trace:
flexcan_read_le+0x0/0x18
flexcan_get_berr_counter+0x4c/0x8c
can_fill_info+0x1f8/0x434
rtnl_fill_ifinfo+0x8fc/0xbb4
rtnl_dump_ifinfo+0x364/0x448This is the same class of problem fixed for m_can in commit 91a55c72a821 ("can: m_can: m_can_get_berr_counter(): don't wake up controller if interface is down").
Note: in 5.10 the netlink code still lives in drivers/net/can/dev/dev.c, so this is a manual backport, not a cherry-pick.
--- drivers/net/can/dev/dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/dev/dev.c +2 -2
@@ -1141,7 +1141,7 @@ static size_t can_get_size(const struct net_device *dev) size +=nla_total_size (sizeof (u32));/* IFLA_CAN_STATE */ size +=nla_total_size (sizeof (struct can_ctrlmode ));/* IFLA_CAN_CTRLMODE */ size +=nla_total_size (sizeof (u32));/* IFLA_CAN_RESTART_MS */ -if (priv->do_get_berr_counter)/* IFLA_CAN_BERR_COUNTER */ +if (priv->do_get_berr_counter &&netif_running (dev))/* IFLA_CAN_BERR_COUNTER */ size +=nla_total_size (sizeof (struct can_berr_counter ));if (priv->data_bittiming.bitrate)/* IFLA_CAN_DATA_BITTIMING */ size +=nla_total_size (sizeof (struct can_bittiming ));
@@ -1186,7 +1186,7 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev)nla_put (skb,IFLA_CAN_CTRLMODE ,sizeof (cm), &cm) ||nla_put_u32 (skb,IFLA_CAN_RESTART_MS , priv->restart_ms) || - (priv->do_get_berr_counter && + (priv->do_get_berr_counter &&netif_running (dev) && !priv->do_get_berr_counter (dev, &bec) && nla_put(skb, IFLA_CAN_BERR_COUNTER, sizeof(bec), &bec)) ||
Signature · 1 line
2.47.3
Re: [PATCH 5.10.y] can: dev: can_fill_info(): don't wake up controller if interface is down
Quoted 1 line
can: dev:
can_fill_info(): don't wake up controller if interface is down
Queued for 5.10, thanks.
Signature · 2 lines
Thanks, Sasha