Skip to content

Commit b06d072

Browse files
wdebruijdavem330
authored andcommitted
macsec: restrict to ethernet devices
Only attach macsec to ethernet devices. Syzbot was able to trigger a KMSAN warning in macsec_handle_frame by attaching to a phonet device. Macvlan has a similar check in macvlan_port_create. v1->v2 - fix commit message typo Reported-by: syzbot <[email protected]> Signed-off-by: Willem de Bruijn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 55b474c commit b06d072

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/net/macsec.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <net/gro_cells.h>
2020
#include <net/macsec.h>
2121
#include <linux/phy.h>
22+
#include <linux/if_arp.h>
2223

2324
#include <uapi/linux/if_macsec.h>
2425

@@ -3665,6 +3666,8 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
36653666
real_dev = __dev_get_by_index(net, nla_get_u32(tb[IFLA_LINK]));
36663667
if (!real_dev)
36673668
return -ENODEV;
3669+
if (real_dev->type != ARPHRD_ETHER)
3670+
return -EINVAL;
36683671

36693672
dev->priv_flags |= IFF_MACSEC;
36703673

0 commit comments

Comments
 (0)