Skip to content

Commit

Permalink
veth: Enforce minimum size of VETH_INFO_PEER
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Graf authored and David S. Miller committed Feb 15, 2012
1 parent 78a5249 commit 2371143
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/veth.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ static void veth_dellink(struct net_device *dev, struct list_head *head)
unregister_netdevice_queue(peer, head);
}

static const struct nla_policy veth_policy[VETH_INFO_MAX + 1];
static const struct nla_policy veth_policy[VETH_INFO_MAX + 1] = {
[VETH_INFO_PEER] = { .len = sizeof(struct ifinfomsg) },
};

static struct rtnl_link_ops veth_link_ops = {
.kind = DRV_NAME,
Expand Down

0 comments on commit 2371143

Please sign in to comment.