Commit 237114384ab22c174ec4641e809f8e6cbcfce774

Authored by Thomas Graf
Committed by David S. Miller
1 parent 78a5249fc9

veth: Enforce minimum size of VETH_INFO_PEER

VETH_INFO_PEER carries struct ifinfomsg plus optional IFLA
attributes. A minimal size of sizeof(struct ifinfomsg) must be
enforced or we may risk accessing that struct beyond the limits
of the netlink message.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff

... ... @@ -422,7 +422,9 @@
422 422 unregister_netdevice_queue(peer, head);
423 423 }
424 424  
425   -static const struct nla_policy veth_policy[VETH_INFO_MAX + 1];
  425 +static const struct nla_policy veth_policy[VETH_INFO_MAX + 1] = {
  426 + [VETH_INFO_PEER] = { .len = sizeof(struct ifinfomsg) },
  427 +};
426 428  
427 429 static struct rtnl_link_ops veth_link_ops = {
428 430 .kind = DRV_NAME,