Commit 237114384ab22c174ec4641e809f8e6cbcfce774
Committed by
David S. Miller
1 parent
78a5249fc9
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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
drivers/net/veth.c
... | ... | @@ -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, |