* [PATCH v2] team: reject CAN and IEEE 802.15.4 devices in team_port_add
@ 2026-07-28 15:12 Jiale Yao
2026-07-29 9:15 ` Jiri Pirko
0 siblings, 1 reply; 2+ messages in thread
From: Jiale Yao @ 2026-07-28 15:12 UTC (permalink / raw)
To: Jiri Pirko, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
Cc: Jiale Yao
Enslaving a CAN or IEEE 802.15.4 device (e.g. vxcan, wpan0) to a
team master triggers a NULL pointer dereference because these
device types use different Layer 2 architectures from Ethernet and
the team driver never initializes their private mid-layer data
structures.
Reject ARPHRD_CAN, ARPHRD_IEEE802154, and ARPHRD_IEEE802154_MONITOR
devices in team_port_add(), mirroring the existing CAN check already
present in the bonding driver since commit 8ba68464e478 ("bonding:
refuse to enslave CAN devices").
Link: https://lore.kernel.org/all/b58d98e0-8fe3-4e4e-b8a5-c1c7e647ccca@hartkopp.net/
Fixes: 1d76efe1577b ("team: add support for non-ethernet devices")
Assisted-by: Claude:deepseek-v4-pro
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
V1 -> V2: Extended check to also reject ARPHRD_IEEE802154 and
ARPHRD_IEEE802154_MONITOR devices per review feedback
---
drivers/net/team/team_core.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c
index feaa75fbf8fc..d8c46105fc8b 100644
--- a/drivers/net/team/team_core.c
+++ b/drivers/net/team/team_core.c
@@ -1224,6 +1224,17 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
return -EINVAL;
}
+ if (port_dev->type == ARPHRD_CAN ||
+ port_dev->type == ARPHRD_IEEE802154 ||
+ port_dev->type == ARPHRD_IEEE802154_MONITOR) {
+ NL_SET_ERR_MSG(extack,
+ "CAN and IEEE 802.15.4 devices can't be added as a team port");
+ netdev_err(dev, "Device %s is CAN or IEEE 802.15.4. These device types can't be added as a team port\n",
+ portname);
+ return -EINVAL;
+ }
+ }
+
if (netif_is_team_port(port_dev)) {
NL_SET_ERR_MSG(extack, "Device is already a port of a team device");
netdev_err(dev, "Device %s is already a port "
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] team: reject CAN and IEEE 802.15.4 devices in team_port_add
2026-07-28 15:12 [PATCH v2] team: reject CAN and IEEE 802.15.4 devices in team_port_add Jiale Yao
@ 2026-07-29 9:15 ` Jiri Pirko
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Pirko @ 2026-07-29 9:15 UTC (permalink / raw)
To: Jiale Yao
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, linux-kernel
Tue, Jul 28, 2026 at 05:12:40PM +0200, yaojiale02@163.com wrote:
>Enslaving a CAN or IEEE 802.15.4 device (e.g. vxcan, wpan0) to a
>team master triggers a NULL pointer dereference because these
>device types use different Layer 2 architectures from Ethernet and
>the team driver never initializes their private mid-layer data
>structures.
>
>Reject ARPHRD_CAN, ARPHRD_IEEE802154, and ARPHRD_IEEE802154_MONITOR
>devices in team_port_add(), mirroring the existing CAN check already
>present in the bonding driver since commit 8ba68464e478 ("bonding:
>refuse to enslave CAN devices").
Can we perhaps have a unified helper for the check?
>
>Link: https://lore.kernel.org/all/b58d98e0-8fe3-4e4e-b8a5-c1c7e647ccca@hartkopp.net/
>Fixes: 1d76efe1577b ("team: add support for non-ethernet devices")
>Assisted-by: Claude:deepseek-v4-pro
Looks your ai gone a bit wild here...
>Signed-off-by: Jiale Yao <yaojiale02@163.com>
>---
>V1 -> V2: Extended check to also reject ARPHRD_IEEE802154 and
> ARPHRD_IEEE802154_MONITOR devices per review feedback
>---
> drivers/net/team/team_core.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
>diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c
>index feaa75fbf8fc..d8c46105fc8b 100644
>--- a/drivers/net/team/team_core.c
>+++ b/drivers/net/team/team_core.c
>@@ -1224,6 +1224,17 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
> return -EINVAL;
> }
>
>+ if (port_dev->type == ARPHRD_CAN ||
>+ port_dev->type == ARPHRD_IEEE802154 ||
>+ port_dev->type == ARPHRD_IEEE802154_MONITOR) {
>+ NL_SET_ERR_MSG(extack,
>+ "CAN and IEEE 802.15.4 devices can't be added as a team port");
>+ netdev_err(dev, "Device %s is CAN or IEEE 802.15.4. These device types can't be added as a team port\n",
>+ portname);
>+ return -EINVAL;
>+ }
>+ }
>+
> if (netif_is_team_port(port_dev)) {
> NL_SET_ERR_MSG(extack, "Device is already a port of a team device");
> netdev_err(dev, "Device %s is already a port "
>--
>2.34.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-29 9:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28 15:12 [PATCH v2] team: reject CAN and IEEE 802.15.4 devices in team_port_add Jiale Yao
2026-07-29 9:15 ` Jiri Pirko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.