[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200322175113.91143-1-willemdebruijn.kernel@gmail.com>
Date: Sun, 22 Mar 2020 13:51:13 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, sd@...asysnail.net, andrew@...n.ch,
Willem de Bruijn <willemb@...gle.com>,
syzbot <syzkaller@...glegroups.com>
Subject: [PATCH net v2] macsec: restrict to ethernet devices
From: Willem de Bruijn <willemb@...gle.com>
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@...glegroups.com>
Signed-off-by: Willem de Bruijn <willemb@...gle.com>
---
drivers/net/macsec.c | 3 +++
1 file changed, 3 insertions(+)
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;
--
2.25.1.696.g5e7596f4ac-goog
Powered by blists - more mailing lists