* [PATCH net] macsec: restrict to ethernet devices
@ 2020-03-22 16:04 Willem de Bruijn
2020-03-22 16:23 ` Andrew Lunn
0 siblings, 1 reply; 3+ messages in thread
From: Willem de Bruijn @ 2020-03-22 16:04 UTC (permalink / raw)
To: netdev; +Cc: davem, sd, Willem de Bruijn, syzbot
From: Willem de Bruijn <willemb@google.com>
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.
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Willem de Bruijn <willemb@google.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] macsec: restrict to ethernet devices
2020-03-22 16:04 [PATCH net] macsec: restrict to ethernet devices Willem de Bruijn
@ 2020-03-22 16:23 ` Andrew Lunn
2020-03-22 17:48 ` Willem de Bruijn
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2020-03-22 16:23 UTC (permalink / raw)
To: Willem de Bruijn; +Cc: netdev, davem, sd, Willem de Bruijn, syzbot
On Sun, Mar 22, 2020 at 12:04:49PM -0400, Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
>
> Only attach macsec to ethernet devices.
>
> Syzbot was able able trigger a KMSAN warning in macsec_handle_frame
able to
Looks sensible otherwise.
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] macsec: restrict to ethernet devices
2020-03-22 16:23 ` Andrew Lunn
@ 2020-03-22 17:48 ` Willem de Bruijn
0 siblings, 0 replies; 3+ messages in thread
From: Willem de Bruijn @ 2020-03-22 17:48 UTC (permalink / raw)
To: Andrew Lunn
Cc: Willem de Bruijn, Network Development, David Miller,
Sabrina Dubroca, syzbot
On Sun, Mar 22, 2020 at 12:23 PM Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Sun, Mar 22, 2020 at 12:04:49PM -0400, Willem de Bruijn wrote:
> > From: Willem de Bruijn <willemb@google.com>
> >
> > 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-22 17:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-22 16:04 [PATCH net] macsec: restrict to ethernet devices Willem de Bruijn
2020-03-22 16:23 ` Andrew Lunn
2020-03-22 17:48 ` Willem de Bruijn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).