diff options
author | Willem de Bruijn <willemb@google.com> | 2020-03-22 13:51:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-03-23 21:34:59 -0700 |
commit | b06d072ccc4b1acd0147b17914b7ad1caa1818bb (patch) | |
tree | 935503ae935ebc291e8da754cbfb1929a33bd415 /drivers | |
parent | 55b474c41e586a5c21c7ab81ff474eb6bacb4322 (diff) | |
download | linux-next-b06d072ccc4b1acd0147b17914b7ad1caa1818bb.tar.gz |
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 <syzkaller@googlegroups.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/macsec.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 6ec6fc191a6e..92bc2b2df660 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -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; |