Skip to content

Commit 4ea85e8

Browse files
tgrafdavem330
authored andcommitted
net: Check for presence of IFLA_AF_SPEC
ndo_bridge_setlink() is currently only called on the slave if IFLA_AF_SPEC is set but this is a very fragile assumption and may change in the future. Cc: Ajit Khaparde <ajit.khaparde@emulex.com> Cc: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: Thomas Graf <tgraf@suug.ch> Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b7c1a31 commit 4ea85e8

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎drivers/net/ethernet/emulex/benet/be_main.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4309,6 +4309,8 @@ static int be_ndo_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh)
43094309
return -EOPNOTSUPP;
43104310

43114311
br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC);
4312+
if (!br_spec)
4313+
return -EINVAL;
43124314

43134315
nla_for_each_nested(attr, br_spec, rem) {
43144316
if (nla_type(attr) != IFLA_BRIDGE_MODE)

‎drivers/net/ethernet/intel/ixgbe/ixgbe_main.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7669,6 +7669,8 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev,
76697669
return -EOPNOTSUPP;
76707670

76717671
br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC);
7672+
if (!br_spec)
7673+
return -EINVAL;
76727674

76737675
nla_for_each_nested(attr, br_spec, rem) {
76747676
__u16 mode;

0 commit comments

Comments
 (0)