macsec: restrict to ethernet devices
[ Upstream commit b06d072ccc
]
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
51db2db8fe
commit
6e75284e24
@ -16,6 +16,7 @@
|
|||||||
#include <net/genetlink.h>
|
#include <net/genetlink.h>
|
||||||
#include <net/sock.h>
|
#include <net/sock.h>
|
||||||
#include <net/gro_cells.h>
|
#include <net/gro_cells.h>
|
||||||
|
#include <linux/if_arp.h>
|
||||||
|
|
||||||
#include <uapi/linux/if_macsec.h>
|
#include <uapi/linux/if_macsec.h>
|
||||||
|
|
||||||
@ -3236,6 +3237,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]));
|
real_dev = __dev_get_by_index(net, nla_get_u32(tb[IFLA_LINK]));
|
||||||
if (!real_dev)
|
if (!real_dev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
if (real_dev->type != ARPHRD_ETHER)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
dev->priv_flags |= IFF_MACSEC;
|
dev->priv_flags |= IFF_MACSEC;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user