Skip to contentSkip to conversation

macsec: restrict to ethernet devices

PATCH Superseded Willem de Bruijn 2 participants 3 messages Mar 22, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 macsec: restrict to ethernet devices

From: Willem de Bruijn <[email protected]>

Only attach macsec to ethernet devices.

Syzbot was able able trigger a KMSAN warning in macsec_handle_frame by attaching to a phonet device.

Macvlan has a similar check in macvlan_port_create.

---
 drivers/net/macsec.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/macsec.c +3 -0
index 6ec6fc191a6e..92bc2b2df660 100644
@@ -19,6 +19,7 @@
 #include <net/gro_cells.h>
 #include <net/macsec.h>
 #include <linux/phy.h>
+#include <linux/if_arp.h>
 
 #include <uapi/linux/if_macsec.h>
 
@@ -3665,6 +3666,8 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
 	real_dev = __dev_get_by_index(net, nla_get_u32(tb[IFLA_LINK]));
 	if (!real_dev)
 		return -ENODEV;
+	if (real_dev->type != ARPHRD_ETHER)
+		return -EINVAL;
 
 	dev->priv_flags |= IFF_MACSEC;
 
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
#1 lore raw
Quoted 5 lines · Willem de Bruijn

From: Willem de Bruijn <[email protected]>

Only attach macsec to ethernet devices.

Syzbot was able able trigger a KMSAN warning in macsec_handle_frame

able to

Looks sensible otherwise.

Andrew

#2 lore raw
Quoted 11 lines · Andrew Lunn
Quoted 5 lines · Willem de Bruijn

From: Willem de Bruijn <[email protected]>

Only attach macsec to ethernet devices.

Syzbot was able able trigger a KMSAN warning in macsec_handle_frame

able to

Looks sensible otherwise.

Thanks! Will send a v2 right away.